:root {
  color-scheme: light;
  --paper: #fffdf8;
  --surface: #ffffff;
  --ink: #22201c;
  --muted: #716b60;
  --line: #ded7c9;
  --soft: #f4efe5;
  --green: #245c4f;
  --green-soft: #e8f2ec;
  --blue: #345781;
  --blue-soft: #e9eef7;
  --orange: #b85c38;
  --orange-soft: #f7e6dc;
  --red: #a43d32;
  --red-soft: #f7dfdc;
  --shadow: 0 16px 42px rgba(38, 31, 21, 0.08);
  font-family: "Songti SC", "Noto Serif CJK SC", "PingFang SC", "Microsoft YaHei", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #e9e3d7;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(246, 241, 230, 0.96)),
    repeating-linear-gradient(0deg, rgba(36, 92, 79, 0.035) 0 1px, transparent 1px 12px);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

code,
pre {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(88px + env(safe-area-inset-bottom));
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(36, 92, 79, 0.08), 0 26px 80px rgba(0, 0, 0, 0.13);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 -14px 14px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid rgba(222, 215, 201, 0.86);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 19px;
  line-height: 1.26;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
}

p {
  line-height: 1.66;
}

.app-main {
  display: grid;
  gap: 14px;
}

.hero,
.panel,
.task-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(36, 92, 79, 0.12), transparent 48%),
    linear-gradient(315deg, rgba(184, 92, 56, 0.11), transparent 56%),
    #fffaf1;
}

.hero.compact {
  padding: 16px;
}

.student-hero {
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(36, 92, 79, 0.11), transparent 54%),
    #fffaf1;
}

.student-hero h2 {
  max-width: 12em;
  font-size: 22px;
}

.student-hero p {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
}

.hero h2 {
  margin-bottom: 7px;
  font-size: 24px;
}

.hero p:last-child,
.panel p:last-child {
  margin-bottom: 0;
}

.panel {
  padding: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.quick-action {
  display: grid;
  gap: 2px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.82);
}

.quick-action.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fffdf8;
}

.quick-action.coach-quick-action {
  border-color: rgba(184, 92, 56, 0.46);
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 196, 105, 0.34), transparent 34%),
    #fff8e9;
  color: #693724;
}

.quick-action strong {
  font-size: 16px;
  line-height: 1.2;
}

.quick-action span {
  color: currentColor;
  opacity: 0.74;
  font-size: 12px;
  font-weight: 800;
}

.today-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  box-shadow: none;
}

.today-summary div {
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.today-summary strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.today-summary span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quiet-panel {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffaf1;
}

.quiet-panel strong {
  display: block;
  margin-bottom: 5px;
}

.quiet-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.done-panel {
  background: var(--green-soft);
}

.mode-banner {
  padding: 13px 14px;
  border: 1px solid #c8b99f;
  border-left: 6px solid var(--orange);
  border-radius: 9px;
  background: #fff5e8;
  box-shadow: var(--shadow);
}

.load-advice {
  padding: 14px 15px;
  border: 1px solid #c8b99f;
  border-left: 6px solid var(--blue);
  border-radius: 9px;
  background: #f3f7fc;
  box-shadow: var(--shadow);
}

.load-advice strong {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
}

.load-advice p {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 13px;
}

.mode-banner strong {
  display: block;
  margin-bottom: 4px;
}

.mode-banner p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.metric-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.metric-card {
  padding: 12px 9px;
  box-shadow: none;
}

.metric-card strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.metric-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-list,
.error-list {
  display: grid;
  gap: 12px;
}

.task-section {
  display: grid;
  gap: 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 3px 0;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading span {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-list.dense {
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-left-width: 6px;
}

.task-card.subject-math {
  border-left-color: var(--green);
}

.task-card.subject-physics {
  border-left-color: var(--blue);
}

.task-card.subject-english {
  border-left-color: var(--orange);
}

.task-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subject-task-card {
  gap: 13px;
}

.subject-task-card h3 {
  margin-bottom: 0;
}

.subject-plan {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
  background: #fffaf1;
}

.subject-plan span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.subject-plan strong {
  font-size: 17px;
  line-height: 1.35;
}

.subject-plan p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.subject-side-note {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.subject-side-note strong {
  color: var(--ink);
}

.task-note {
  margin-bottom: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.subject-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 7px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.status-pill {
  flex: none;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.done {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.repair,
.status-pill.waiting {
  background: var(--orange-soft);
  color: var(--orange);
}

.status-pill.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.meta-row,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-row span,
.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag-list.vertical {
  display: grid;
}

.tag-list.vertical span {
  justify-content: flex-start;
  border-radius: 7px;
  min-height: 36px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.button,
.ghost-button,
.role-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: #fffdf8;
  font-weight: 900;
  cursor: pointer;
}

.button.secondary {
  border-color: var(--green);
  background: var(--green);
}

.ghost-button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.button:disabled {
  border-color: #c9c0ae;
  background: #c9c0ae;
  cursor: not-allowed;
}

.role-switch {
  min-height: 36px;
  border-color: var(--green);
  background: var(--green);
  font-size: 13px;
  white-space: nowrap;
}

.step-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.step-list li.current {
  border-color: rgba(36, 92, 79, 0.45);
  background: var(--green-soft);
}

.step-list li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.step-list p {
  margin-bottom: 0;
}

.form-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.check-list {
  display: grid;
  gap: 9px;
}

.check-list label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  line-height: 1.55;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-grid .checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
}

.form-grid .checkbox-line input {
  width: auto;
  min-height: auto;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink);
}

.form-grid textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.adjustment-list,
.material-list,
.attempt-list,
.print-list {
  display: grid;
  gap: 10px;
}

.adjustment-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fffdf8;
}

.adjustment-card strong {
  display: block;
  margin-bottom: 5px;
}

.adjustment-card p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.adjustment-card small {
  color: var(--muted);
}

.material-row {
  position: relative;
}

.print-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.print-card h3 {
  margin-bottom: 6px;
}

.print-card p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.print-card code {
  display: block;
  padding: 8px;
  border-radius: 7px;
  background: var(--soft);
  font-size: 12px;
  word-break: break-all;
}

.material-row code {
  word-break: break-all;
  font-size: 12px;
}

.empty-state {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.7;
}

.path-list {
  display: grid;
  gap: 8px;
}

.path-list p {
  margin-bottom: 0;
  word-break: break-all;
}

.pdf-frame {
  overflow: hidden;
  height: min(72vh, 640px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f1e7;
}

.pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.upload-drop {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 24px 14px;
  border: 1px dashed #9d927f;
  border-radius: 9px;
  background: #fffaf1;
  cursor: pointer;
}

.upload-drop input {
  max-width: 100%;
}

.upload-drop span {
  font-size: 17px;
  font-weight: 900;
}

.upload-drop small {
  color: var(--muted);
}

.preview {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 92px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
}

.preview.empty {
  place-items: center;
  color: var(--muted);
}

.preview img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.upload-gallery {
  display: grid;
  gap: 10px;
  width: 100%;
}

.upload-gallery figure {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.upload-gallery img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8f3e8;
}

.upload-gallery figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.file-preview-card {
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: center;
  min-height: 156px;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 112px;
  border: 2px solid var(--red);
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.compact-gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-gallery img,
.compact-gallery .file-preview-card {
  height: 160px;
}

.attempt-card {
  display: grid;
  gap: 12px;
}

.sync-list {
  display: grid;
  gap: 10px;
}

.sync-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.sync-row p {
  margin: 5px 0 0;
  color: var(--muted);
}

.insight-list,
.analysis-list {
  display: grid;
  gap: 10px;
}

.teacher-summary {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #f6fbf7;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.65;
}

.correction-feedback {
  margin: 12px 0;
  padding: 13px 15px;
  border: 1px solid rgba(177, 74, 62, 0.22);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: var(--red-soft);
}

.correction-feedback.done-panel {
  border-color: rgba(36, 92, 79, 0.22);
  border-left-color: var(--green);
  background: var(--green-soft);
}

.correction-feedback p:last-child {
  margin-bottom: 0;
}

.coach-room {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid #d9c8aa;
  border-radius: 12px;
  background:
    linear-gradient(112deg, rgba(255, 250, 238, 0.98), rgba(245, 237, 216, 0.94)),
    repeating-linear-gradient(0deg, rgba(91, 68, 37, 0.03) 0 1px, transparent 1px 9px);
  box-shadow: 0 18px 48px rgba(72, 51, 23, 0.12);
}

.coach-room::after {
  position: absolute;
  right: -24px;
  bottom: -44px;
  width: 154px;
  height: 154px;
  border: 1px solid rgba(36, 92, 79, 0.12);
  border-radius: 50%;
  content: "";
}

.coach-room-glow {
  position: absolute;
  top: -95px;
  left: -65px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 181, 78, 0.34), rgba(250, 181, 78, 0) 67%);
  pointer-events: none;
}

.coach-intro {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: flex-start;
}

.coach-intro h2 {
  margin-bottom: 7px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.coach-intro p:last-child {
  margin-bottom: 0;
  color: #776a57;
  font-size: 13px;
}

.coach-lamp {
  position: relative;
  width: 50px;
  height: 62px;
  margin-top: 3px;
}

.coach-lamp::before {
  position: absolute;
  top: 4px;
  left: 7px;
  width: 36px;
  height: 28px;
  border: 2px solid #7c472c;
  border-radius: 28px 28px 8px 8px;
  background: linear-gradient(180deg, #f3ab52, #c96c36);
  box-shadow: 0 9px 20px rgba(230, 144, 55, 0.38);
  content: "";
}

.coach-lamp::after {
  position: absolute;
  bottom: 3px;
  left: 24px;
  width: 3px;
  height: 30px;
  background: #6d513b;
  box-shadow: -9px 28px 0 7px #6d513b;
  content: "";
}

.coach-lamp span {
  position: absolute;
  top: 29px;
  left: 12px;
  width: 29px;
  height: 24px;
  background: linear-gradient(180deg, rgba(255, 206, 117, 0.36), transparent);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.coach-context-strip {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.coach-context-strip span,
.coach-context-strip a {
  padding: 7px 9px;
  border: 1px solid rgba(110, 79, 45, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: #65533e;
  font-size: 11px;
  font-weight: 800;
}

.coach-context-strip a {
  border-color: rgba(36, 92, 79, 0.26);
  color: var(--green);
}

.coach-thread {
  display: grid;
  gap: 12px;
  min-height: 240px;
  padding: 4px 1px;
}

.coach-message {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: coach-note-in 260ms ease-out both;
}

.coach-typing[hidden] {
  display: none;
}

.coach-message.from-student {
  justify-content: flex-end;
}

.coach-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #b8895c;
  border-radius: 50% 50% 42% 42%;
  background: #f2c47e;
  color: #5f3b22;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(114, 73, 33, 0.14);
}

.coach-bubble {
  width: fit-content;
  max-width: 86%;
  padding: 12px 13px;
  border: 1px solid #dfd2bd;
  border-radius: 5px 13px 13px 13px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(252, 247, 236, 0.98));
  box-shadow: 0 9px 24px rgba(55, 42, 25, 0.07);
}

.from-student .coach-bubble {
  border-color: #245c4f;
  border-radius: 13px 5px 13px 13px;
  background: #245c4f;
  color: #fffdf8;
}

.coach-bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
}

.coach-bubble small {
  display: block;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(99, 78, 49, 0.22);
  color: #8a755a;
  font-size: 10px;
  line-height: 1.55;
}

.coach-attachment {
  margin-top: 9px;
}

.coach-attachment figure {
  margin: 0;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
}

.coach-attachment img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 5px;
}

.coach-attachment figcaption {
  margin-top: 4px;
  font-size: 9px;
  opacity: 0.75;
  word-break: break-all;
}

.coach-mood {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.welcome-note .coach-bubble {
  border-left: 4px solid #d18b42;
}

.coach-quick-replies {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 2px 0 5px;
  scrollbar-width: none;
}

.coach-quick-replies::-webkit-scrollbar {
  display: none;
}

.coach-quick-replies button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cdbb9e;
  border-radius: 999px;
  background: #fff9ed;
  color: #624a31;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.coach-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 92, 79, 0.24);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
}

.coach-action-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.coach-action-card a,
.coach-action-card strong {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.coach-composer {
  position: sticky;
  z-index: 15;
  bottom: calc(70px + env(safe-area-inset-bottom));
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #cdbfa8;
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 -10px 34px rgba(52, 42, 27, 0.1);
  backdrop-filter: blur(18px);
}

.coach-composer > label {
  color: #69583f;
  font-size: 11px;
  font-weight: 900;
}

.coach-composer > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
}

.coach-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 9px;
  border: 1px solid #d6c8b2;
  border-radius: 8px;
  background: #fff3dc;
  color: #7a4c2d;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.coach-file-button input {
  display: none;
}

.coach-composer textarea {
  width: 100%;
  min-height: 54px;
  max-height: 140px;
  padding: 10px 11px;
  border: 1px solid #d6c8b2;
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  line-height: 1.55;
  resize: vertical;
}

.coach-composer button {
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.coach-composer button:disabled {
  opacity: 0.54;
}

.coach-composer small {
  color: var(--muted);
  font-size: 10px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 18px;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ba7443;
  animation: coach-dot 900ms infinite ease-in-out;
}

.typing-dots i:nth-child(2) { animation-delay: 120ms; }
.typing-dots i:nth-child(3) { animation-delay: 240ms; }

.coach-nav-icon {
  border-color: #b96739;
  color: #9b4f2e;
}

@keyframes coach-note-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes coach-dot {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.45; }
  35% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .coach-message,
  .typing-dots i {
    animation: none;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.role-switch[hidden],
.bottom-nav a[hidden] {
  display: none;
}

body.student-session .bottom-nav {
  grid-template-columns: repeat(4, 1fr);
}

.student-switcher {
  display: grid;
  gap: 2px;
  min-width: 126px;
}

.student-switcher[hidden] {
  display: none;
}

.student-switcher label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.student-switcher select {
  min-height: 34px;
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 28px 0 9px;
  background: #fffaf1;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.student-switcher.switching {
  opacity: .55;
  pointer-events: none;
}

.profile-choice {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.profile-choice legend {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.profile-choice-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 8px 11px;
  border: 1px solid #cbbfa9;
  border-radius: 8px;
  background: rgba(255, 253, 248, .86);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.profile-choice-card:hover {
  transform: translateY(-1px);
}

.profile-choice-card:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 3px rgba(36, 92, 79, .09);
}

.profile-choice-card.parent-choice:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-soft);
  box-shadow: 0 0 0 3px rgba(184, 92, 56, .09);
}

.profile-choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.profile-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px 9px 9px 3px;
  background: var(--soft);
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
}

.profile-choice-card:has(input:checked) .profile-mark {
  background: var(--green);
  color: #fffaf0;
}

.profile-choice-card.parent-choice:has(input:checked) .profile-mark {
  background: var(--orange);
}

.profile-choice-card strong,
.profile-choice-card small {
  display: block;
}

.profile-choice-card strong {
  margin-bottom: 2px;
  color: var(--ink);
}

.profile-choice-card small {
  color: var(--muted);
  font-size: 11px;
}

.family-access-grid {
  display: grid;
  gap: 14px;
}

.family-access-grid .access-ticket {
  grid-template-columns: 1fr;
}

.family-access-grid .junior-ticket {
  border-top: 5px solid var(--orange);
}

.family-access-grid .senior-ticket {
  border-top: 5px solid var(--green);
}

.junior-ticket .ticket-label {
  color: var(--orange);
}

.junior-ticket .access-ticket-copy code {
  border-left-color: var(--orange);
}

@media (min-width: 760px) {
  .family-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar-actions {
    gap: 6px;
  }

  .student-switcher {
    min-width: 104px;
  }

  .student-switcher select {
    max-width: 118px;
  }

  body:has(.student-switcher:not([hidden])) .role-switch {
    display: none;
  }
}

@media (max-height: 900px) {
  .family-login {
    place-items: start center;
    padding-top: 34px;
    padding-bottom: 50px;
  }

  .login-footnote {
    display: none;
  }
}

.baseline-panel {
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(184, 92, 56, .07), transparent 44%),
    #fffdf8;
}

.baseline-panel .section-heading {
  align-items: flex-start;
  margin-bottom: 12px;
}

.baseline-panel .section-heading h2 {
  margin-bottom: 0;
}

.baseline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.baseline-score {
  display: grid;
  gap: 5px;
  min-height: 70px;
  align-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
}

.baseline-score span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.baseline-score strong {
  color: var(--green);
  font-size: 22px;
}

.baseline-score.new-subject {
  border-style: dashed;
  background: var(--orange-soft);
}

.baseline-score.new-subject strong {
  color: var(--orange);
  font-size: 15px;
}

.baseline-completed {
  margin: 12px 0 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.policy-note {
  margin-top: 12px;
  padding: 12px;
  border-left: 4px solid var(--orange);
  background: #fff7eb;
}

.policy-note p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 12px;
}

.policy-note a {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 360px) {
  .baseline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.compact-list {
  margin-top: 10px;
}

.insight-list p,
.analysis-card {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(222, 215, 201, 0.88);
  border-radius: 8px;
  background: #fffaf0;
}

.analysis-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}

.analysis-card p {
  margin: 0;
  color: var(--muted);
}

.teacher-card {
  background: #fffdf8;
}

.teacher-card p {
  line-height: 1.75;
}

.explanation-steps {
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.85;
}

.explanation-steps li + li {
  margin-top: 6px;
}

.method-tip {
  margin-top: 10px !important;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f0e8;
  color: var(--ink) !important;
  font-weight: 800;
}

.result-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.result-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table th,
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  background: #f6f0e8;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.grading-table td:last-child {
  min-width: 220px;
  line-height: 1.6;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.recorded-errors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 13px 14px;
  border: 1px solid rgba(32, 96, 80, 0.22);
  border-radius: 8px;
  background: #f6fbf7;
}

.recorded-errors strong {
  color: var(--green);
}

.recorded-error-tags {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.recorded-error-tags p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.hint-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.hint-list li + li {
  margin-top: 8px;
}

.check-list.static label {
  cursor: default;
}

.attempt-card header,
.correction-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.grading-form {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.code-block {
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #26221d;
  color: #fff6e6;
  font-size: 12px;
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222, 215, 201, 0.92);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 5px 2px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bottom-nav a.active {
  background: var(--green-soft);
  color: var(--green);
}

.app-toast {
  position: fixed;
  right: 18px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 18px;
  z-index: 40;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid rgba(36, 92, 79, 0.22);
  border-radius: 9px;
  background: rgba(34, 32, 28, 0.94);
  color: #fffdf8;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 11px;
}

@media (max-width: 390px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stack-on-small {
    display: grid;
  }
}

@media (min-width: 840px) {
  .app-shell,
  .bottom-nav {
    width: min(100%, 860px);
  }

  .task-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 家庭局域网接入：像一张被台灯照亮的晚自习入场卡。 */
body.auth-screen {
  min-height: 100vh;
  background:
    radial-gradient(circle at 76% 9%, rgba(255, 209, 123, 0.36), transparent 25%),
    linear-gradient(145deg, #173c35 0%, #245c4f 48%, #152f2b 100%);
}

body.auth-screen .app-shell {
  display: grid;
  width: min(100%, 920px);
  min-height: 100vh;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.auth-screen .topbar,
body.auth-screen .bottom-nav {
  display: none;
}

body.auth-screen .app-main {
  min-height: 100vh;
}

.family-login {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  padding: max(40px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.family-login::before {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 10px),
    linear-gradient(110deg, transparent 0 47%, rgba(255, 244, 215, 0.055) 47% 48%, transparent 48% 100%);
  content: "";
  pointer-events: none;
}

.login-lamp {
  position: absolute;
  top: -28px;
  right: clamp(18px, 10vw, 100px);
  width: 130px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 232, 173, 0.96), rgba(255, 199, 91, 0.16) 42%, transparent 72%);
  filter: blur(1px);
  transform: rotate(-8deg);
  animation: lamp-arrive 700ms cubic-bezier(.2,.8,.2,1) both;
}

.login-lamp span {
  position: absolute;
  top: 5px;
  left: 47px;
  width: 44px;
  height: 26px;
  border-radius: 50% 50% 36% 36%;
  background: #e6a94d;
  box-shadow: 0 4px 18px rgba(255, 215, 127, 0.66);
}

.login-paper {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid rgba(81, 68, 43, 0.24);
  border-radius: 4px 16px 6px 11px;
  background:
    linear-gradient(90deg, transparent 0 45px, rgba(184, 92, 56, 0.12) 45px 46px, transparent 46px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(52, 87, 129, 0.07) 31px 32px),
    #fffaf0;
  box-shadow: 0 32px 80px rgba(4, 20, 17, 0.38), 12px 13px 0 rgba(16, 47, 41, 0.36);
  transform: rotate(-0.45deg);
  animation: paper-arrive 600ms 80ms cubic-bezier(.16,.8,.2,1) both;
}

.login-kicker {
  margin-bottom: 13px;
  color: var(--orange);
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.login-paper h1 {
  max-width: 9em;
  margin-bottom: 16px;
  color: #1f302b;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.login-intro {
  margin-bottom: 26px;
  color: #5f5a50;
  font-size: 14px;
  line-height: 1.82;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form > label {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.access-code-field {
  display: grid;
  grid-template-columns: 46px 1fr;
  overflow: hidden;
  min-height: 54px;
  border: 1px solid #b7aa92;
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.86);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.access-code-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(36, 92, 79, 0.12);
}

.access-code-field span {
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fffaf0;
  font-size: 18px;
  font-weight: 900;
}

.access-code-field input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0 15px;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.access-code-field input::placeholder {
  color: #9f9789;
  font-size: 15px;
  letter-spacing: 0;
}

.login-button {
  width: 100%;
  margin-top: 4px;
  min-height: 50px;
  border-color: var(--orange);
  background: var(--orange);
}

.login-message {
  min-height: 22px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #c9bfae;
}

.login-trust span {
  padding: 5px 8px;
  border-radius: 99px;
  background: rgba(36, 92, 79, 0.08);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.login-footnote {
  position: absolute;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 0;
  margin: 0;
  color: rgba(255, 250, 240, 0.66);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.08em;
}

@keyframes paper-arrive {
  from { opacity: 0; transform: translateY(22px) rotate(-1.2deg) scale(.98); }
  to { opacity: 1; transform: translateY(0) rotate(-0.45deg) scale(1); }
}

@keyframes lamp-arrive {
  from { opacity: 0; transform: translateY(-18px) rotate(-8deg); }
  to { opacity: 1; transform: translateY(0) rotate(-8deg); }
}

.access-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  background:
    linear-gradient(115deg, rgba(255, 250, 240, 0.04), transparent 58%),
    var(--green);
  color: #fffaf0;
  box-shadow: 0 20px 46px rgba(24, 62, 53, 0.19);
}

.access-hero::after {
  position: absolute;
  right: -40px;
  bottom: -68px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(255, 250, 240, 0.14);
  border-radius: 50%;
  content: "";
}

.access-hero .eyebrow {
  color: #ffd796;
}

.access-hero h2 {
  max-width: 12em;
  margin-bottom: 8px;
  font-size: 27px;
}

.access-hero p:last-child {
  max-width: 40em;
  margin-bottom: 0;
  color: rgba(255, 250, 240, 0.75);
  font-size: 13px;
}

.lan-state {
  z-index: 1;
  justify-self: start;
  padding: 7px 10px;
  border: 1px solid rgba(255, 250, 240, 0.35);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 900;
}

.lan-state.online::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #9fe0b0;
  box-shadow: 0 0 0 4px rgba(159, 224, 176, 0.13);
  content: "";
}

.access-ticket {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid #d5cbb9;
  border-radius: 6px 15px 8px 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(52, 87, 129, 0.055) 25px 26px),
    #fffaf0;
  box-shadow: var(--shadow);
}

.qr-frame {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
}

.qr-frame svg {
  display: block;
  width: min(100%, 230px);
  height: auto;
}

.access-ticket-copy {
  align-self: center;
}

.ticket-label {
  margin-bottom: 7px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.access-ticket-copy h3 {
  font-size: 21px;
}

.access-ticket-copy p {
  color: var(--muted);
  font-size: 13px;
}

.access-ticket-copy code {
  display: block;
  margin-bottom: 11px;
  padding: 10px;
  border-left: 3px solid var(--orange);
  background: rgba(184, 92, 56, 0.08);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  word-break: break-all;
}

.access-steps ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-steps li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.access-steps li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-weight: 900;
}

.access-steps strong {
  display: block;
  margin-bottom: 3px;
}

.access-steps p,
.access-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 700px) {
  .access-hero {
    grid-template-columns: 1fr auto;
    align-items: start;
    padding: 28px;
  }

  .access-ticket {
    grid-template-columns: minmax(230px, .82fr) 1.18fr;
    padding: 24px;
  }

  .access-steps ol {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-paper,
  .login-lamp {
    animation: none;
  }
}

/* Stage 22 · a paper timetable that keeps the plan visible without feeling like a KPI dashboard */
.study-rhythm {
  position: relative;
  overflow: hidden;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #d5c8b5;
  border-radius: 7px 16px 9px 12px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(184, 92, 56, 0.13) 31px 32px, transparent 32px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(52, 87, 129, 0.05) 27px 28px),
    #fffaf0;
  box-shadow: 0 14px 32px rgba(56, 44, 31, 0.09);
}

.study-rhythm::after {
  position: absolute;
  top: -26px;
  right: 8%;
  width: 68px;
  height: 42px;
  border: 1px solid rgba(113, 96, 71, 0.2);
  background: rgba(237, 220, 181, 0.55);
  transform: rotate(2deg);
  content: "";
}

.study-rhythm-head {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
  margin-left: 26px;
}

.study-rhythm-head .eyebrow {
  margin-bottom: 3px;
  color: var(--orange);
}

.study-rhythm-head h2 {
  margin: 0;
  font-size: clamp(20px, 4.8vw, 26px);
}

.study-rhythm-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(36, 92, 79, 0.17);
  border-radius: 99px;
  background: rgba(36, 92, 79, 0.07);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.rhythm-goal,
.rhythm-note {
  margin: 10px 0 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.rhythm-bar {
  display: flex;
  height: 44px;
  margin: 17px 0 11px 26px;
  overflow: hidden;
  border: 3px solid #fffdf8;
  border-radius: 6px;
  outline: 1px solid #bbae9a;
  background: #eee5d6;
  box-shadow: 0 6px 14px rgba(56, 44, 31, 0.11);
}

.rhythm-segment {
  position: relative;
  display: grid;
  flex: 0 0 var(--segment);
  place-items: center;
  min-width: 0;
  color: #fffdf8;
}

.rhythm-segment + .rhythm-segment {
  border-left: 2px solid rgba(255, 253, 248, 0.72);
}

.rhythm-segment b {
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.rhythm-segment.segment-1,
.rhythm-legend i.segment-1 { background: #245c4f; }
.rhythm-segment.segment-2,
.rhythm-legend i.segment-2 { background: #b85c38; }
.rhythm-segment.segment-3,
.rhythm-legend i.segment-3 { background: #d6a445; }
.rhythm-segment.segment-4,
.rhythm-legend i.segment-4 { background: #647a93; }

.rhythm-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-left: 26px;
}

.rhythm-legend span {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.rhythm-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.rhythm-legend strong {
  color: var(--ink);
  font-weight: 900;
}

.parent-rhythm {
  margin: 0 0 18px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(184, 92, 56, 0.1) 31px 32px, transparent 32px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(52, 87, 129, 0.04) 27px 28px),
    #fffdf8;
}

@media (max-width: 520px) {
  .study-rhythm {
    padding: 16px 13px 15px 10px;
  }

  .study-rhythm-head {
    display: block;
  }

  .study-rhythm-head > span {
    display: inline-block;
    margin-top: 8px;
  }

  .rhythm-legend {
    grid-template-columns: 1fr;
  }

  .rhythm-goal {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

.curriculum-lock {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  margin: 13px 0 0 26px;
  padding: 10px 12px;
  border: 1px solid rgba(36, 92, 79, 0.18);
  border-radius: 7px;
  background: rgba(36, 92, 79, 0.065);
}

.curriculum-lock span {
  grid-row: 1 / span 2;
  padding: 5px 7px;
  border-radius: 4px;
  background: var(--green);
  color: #fffaf0;
  font-size: 11px;
  font-weight: 900;
}

.curriculum-lock strong {
  color: var(--ink);
  font-size: 13px;
}

.curriculum-lock small {
  color: var(--muted);
  font-size: 11px;
}

.textbook-library {
  margin-bottom: 24px;
}

.textbook-grid {
  display: grid;
  gap: 14px;
}

.textbook-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 13px 1fr;
  min-height: 250px;
  border: 1px solid #cabda8;
  border-radius: 5px 13px 8px 5px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.54), transparent 46%),
    #f4ead7;
  box-shadow: 0 13px 28px rgba(56, 44, 31, 0.1);
}

.textbook-card::after {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(36, 92, 79, 0.22);
  border-radius: 50%;
  content: "教材";
  color: rgba(36, 92, 79, 0.7);
  font: 900 11px/48px "Songti SC", serif;
  text-align: center;
  transform: rotate(-8deg);
}

.textbook-spine {
  background: var(--green);
  box-shadow: inset -3px 0 rgba(255, 255, 255, 0.18);
}

.textbook-card.subject-physics .textbook-spine { background: #557da0; }
.textbook-card.subject-chemistry .textbook-spine { background: #8a7eb5; }

.textbook-card > div:last-child {
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: 20px 19px 18px;
}

.textbook-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.textbook-card h3 {
  margin: 7px 0 5px;
  max-width: calc(100% - 55px);
  font-size: 22px;
}

.textbook-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.textbook-card small {
  color: #7a6d5c;
  font-size: 11px;
}

.chapter-preview {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 14px 0 16px;
  padding-top: 12px;
  border-top: 1px dashed #c7b8a2;
}

.chapter-preview b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.textbook-card .ghost-button {
  margin-top: auto;
}

.material-heading {
  margin-top: 28px;
}

@media (min-width: 720px) {
  .textbook-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .curriculum-lock {
    grid-template-columns: 1fr;
  }

  .curriculum-lock span {
    grid-row: auto;
    justify-self: start;
  }
}
