/* Sunny 老师 demo · 页面样式（配色沿用助教页 tutor.css 的纸色系，Sunny 用暖黄） */
:root {
  --paper: #f5f1e8; --panel: #ffffff; --ink: #1f2a30; --ink-2: #4a555c; --muted: #8a8276; --line: #e4ddd0;
  --teal: #2f7f78; --teal-ink: #1f5f5a; --teal-soft: #e3f1ef; --amber: #b7791f; --amber-soft: #fbf1dc;
  --slate: #5b6b8c; --slate-soft: #e9edf5; --red: #b3402f;
  --sun: #f2a93b; --sun-deep: #e08a1e; --sun-soft: #fff1d2;
  --radius: 14px; --shadow: 0 6px 24px rgba(31, 42, 48, .08);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
         border-radius: 10px; padding: 8px 14px; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--teal-ink); }
button.wide { width: 100%; padding: 12px; }
button.ghost { background: transparent; }
input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus { outline: 2px solid var(--sun-soft); border-color: var(--sun-deep); }

/* ---- Sunny 的「头」：一个会动的圆 ---- */
.orb { display: inline-block; width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
       background: radial-gradient(circle at 35% 30%, #ffe9a8 0, var(--sun) 55%, var(--sun-deep) 100%);
       box-shadow: 0 0 0 6px var(--sun-soft); }
.orb.sm { width: 26px; height: 26px; box-shadow: none; }
.orb.big { width: 120px; height: 120px; box-shadow: 0 0 0 14px var(--sun-soft); }
.orb.listen::after, .orb.user::after, .orb.speak::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--sun); opacity: 0; }
.orb.listen::after { animation: pulse 1.6s ease-out infinite; }
.orb.user::after { animation: pulse .9s ease-out infinite; }
.orb.speak::after { animation: pulse 1.1s ease-in-out infinite; }
.orb.speak { animation: glow 1.1s ease-in-out infinite; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 6px var(--sun-soft); } 50% { box-shadow: 0 0 0 12px #ffe3a3; } }

/* ---- 登录 / 选档案 ---- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
             box-shadow: var(--shadow); padding: 32px 32px 24px; }
.gate-card h1 { margin: 12px 0 0; font-size: 28px; }
.gate-card h2 { margin: 0 0 4px; font-size: 22px; }
.sunlogo { font-size: 56px; line-height: 1; }
.gate-card .sub { margin: 2px 0 22px; color: var(--muted); }
.field { display: block; margin: 12px 0; color: var(--ink-2); font-size: 14px; }
.field input { margin-top: 6px; font-size: 16px; }
.gate-card button.primary { margin-top: 10px; }
.err { color: var(--red); min-height: 1.4em; margin: 8px 0 0; font-size: 14px; }
.fine { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px;
        color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--sun-deep); color: var(--ink); }
.chip.on { background: var(--sun-soft); border-color: var(--sun-deep); color: var(--ink); }

/* ---- 主界面 ---- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
       gap: 12px; padding: 10px 20px; background: rgba(245, 241, 232, .92); backdrop-filter: blur(6px);
       border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand small, .stu { color: var(--muted); font-size: 13px; }
.stu { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; color: var(--ink-2); }
.tools { display: flex; align-items: center; gap: 8px; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1.6fr) minmax(360px, 1fr); gap: 16px;
          max-width: 1560px; margin: 0 auto; padding: 16px 20px 24px; align-items: start; }

/* 左：课 */
.lessons { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.lessons h3 { margin: 4px 8px 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.lesson { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
          border-radius: 10px; padding: 8px; margin-bottom: 4px; }
.lesson.on { background: var(--sun-soft); border-color: var(--sun-deep); }
.lesson b { display: block; font-size: 15px; line-height: 1.35; }
.lesson span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.lesson .bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.lesson .bar i { display: block; height: 100%; background: var(--sun); }
.lesson img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #eee; }

/* 中：视频 / 聊天 */
.stage { min-width: 0; }
#video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); }
.chapters { display: flex; gap: 3px; margin: 10px 0 6px; }
.chapter { flex: 1 1 0; min-width: 0; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line);
           background: var(--panel); font-size: 12px; color: var(--ink-2); text-align: left; line-height: 1.3;
           overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex-grow: var(--w, 1); }
.chapter.on { background: var(--sun-soft); border-color: var(--sun-deep); color: var(--ink); font-weight: 600; white-space: normal; }
.chapter.done { color: var(--muted); }
.now { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
#nowKp { color: var(--muted); font-size: 14px; }
.resume { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; animation: glow2 1.4s ease-in-out infinite; }
@keyframes glow2 { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,127,120,.0); } 50% { box-shadow: 0 0 0 6px rgba(47,127,120,.22); } }
.notes { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-top: 6px; }
.notes summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.notes summary small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.notes ol { margin: 8px 0 2px; padding-left: 22px; }
.notes li { margin: 6px 0; color: var(--ink-2); font-size: 14px; }
.notes li b { color: var(--ink); }
.notes li em { font-style: normal; color: var(--teal-ink); font-variant-numeric: tabular-nums; margin-right: 6px; }
.notes li.click { cursor: pointer; }
.notes li.click:hover b { color: var(--sun-deep); }
.source { color: var(--muted); font-size: 12px; margin: 10px 2px 0; }
.source a { color: var(--muted); }
.chatpane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 28px;
            text-align: center; aspect-ratio: 16/9; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.chatpane h2 { margin: 8px 0 0; }
.chatpane p { color: var(--ink-2); margin: 0; }
.chatpane .try { color: var(--muted); font-size: 14px; }

/* 右：Sunny */
.sunny { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
         display: flex; flex-direction: column; height: calc(100vh - 96px); position: sticky; top: 72px; overflow: hidden; }
.shead { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.shead .st { flex: 1; min-width: 0; }
.shead b { display: block; font-size: 15px; }
.shead span { display: block; color: var(--muted); font-size: 13px; }
.mic { width: 46px; height: 46px; border-radius: 50%; font-size: 20px; padding: 0; flex: none; }
.mic.on { background: var(--sun-soft); border-color: var(--sun-deep); }
.mic.off { opacity: .6; }
.log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--teal-soft); border: 1px solid #cfe5e2; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--sun-soft); border: 1px solid #f3dcb0; border-bottom-left-radius: 4px; }
.msg.bot .say { display: block; }
.msg.bot .say.en { color: var(--teal-ink); }
.msg.bot .say.now { background: #ffe3a3; border-radius: 4px; }
.msg.bot .zh { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 13px; padding: 0 12px; }
.msg.err { align-self: flex-start; background: #fbe9e6; color: var(--red); border: 1px solid #f0cfc9; }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.tag { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag span { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.tag span.src { cursor: pointer; border-color: var(--teal); color: var(--teal-ink); }
.tag span.src:hover { background: var(--teal-soft); }
.sunny .chips { padding: 0 14px 8px; }
.composer { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

/* 导览 / 提示 */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(31,42,48,.45); display: flex; align-items: center;
         justify-content: center; padding: 20px; }
.modal-card { position: relative; width: min(560px, 100%); background: var(--panel); border-radius: var(--radius);
              padding: 28px 30px 24px; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 12px; }
.modal-card .close { position: absolute; top: 10px; right: 12px; border: 0; font-size: 22px; line-height: 1; padding: 4px 8px; }
.steps { padding-left: 22px; margin: 0; }
.steps li { margin: 10px 0; color: var(--ink-2); }
.steps b { display: block; color: var(--ink); font-size: 16px; }
.steps em { font-style: normal; color: var(--teal-ink); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--ink);
         color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none;
         transition: all .25s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 窄屏：视频在上、Sunny 在下 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); }
  .lessons { grid-column: 1 / -1; display: flex; gap: 8px; overflow-x: auto; }
  .lessons h3 { display: none; }
  .lesson { min-width: 200px; margin: 0; }
  .lesson img { display: none; }
  .sunny { height: calc(100vh - 96px); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .sunny { position: static; height: 70vh; }
  .brand small, .stu { display: none; }
  .chatpane { aspect-ratio: auto; }
}
