:root {
  --stage-width: 1600;
  --stage-height: 900;
  --app-scale: 1;
  --bg: #fffaf2;
  --paper: #fffdf8;
  --card: #fffdfa;
  --line: #f1e3cf;
  --ink: #2d2b2b;
  --muted: #8e877c;
  --orange: #ff7a2f;
  --orange-soft: #fff0e3;
  --green: #77bf8e;
  --green-soft: #edf8f0;
  --blue: #6da7ec;
  --blue-soft: #eef6ff;
  --purple: #cc9ad8;
  --purple-soft: #f8eefb;
  --gray-soft: #f7f3ec;
  --danger: #ff6a3d;
  --shadow: 0 8px 24px rgba(210, 171, 108, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 47, 0.06), transparent 22%),
    radial-gradient(circle at bottom right, rgba(125, 191, 142, 0.08), transparent 24%),
    var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.app-viewport {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  background: none;
}

.praise-language-switcher {
  gap: 3px !important;
  height: 42px !important;
  padding: 3px !important;
  border: 1px solid #f2d6bd !important;
  background: rgba(255, 248, 238, 0.9) !important;
  box-shadow: 0 6px 16px rgba(139, 103, 45, 0.09) !important;
}

.praise-language-option {
  width: auto !important;
  min-width: 42px !important;
  height: 36px !important;
  padding: 0 10px !important;
  color: #77716a !important;
  font: 800 17px/1 "PingFang SC", "Microsoft YaHei", sans-serif !important;
}

.praise-language-option:hover {
  background: rgba(255, 122, 47, 0.10) !important;
}

.praise-language-option.active {
  background: var(--orange, #ff7a2f) !important;
  color: #fffaf2 !important;
  box-shadow: 0 5px 12px rgba(224, 83, 12, 0.20) !important;
}

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

.app-shell {
  width: calc(var(--stage-width) * 1px);
  height: calc(var(--stage-height) * 1px);
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-rows: 86px minmax(0, 1fr);
  padding: 0 18px 16px;
  margin: 0 auto;
  transform: scale(var(--app-scale));
  transform-origin: center center;
  overflow: hidden;
}

.topbar,
.page {
  width: 100%;
  margin: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(480px, 1fr) max-content max-content;
  align-items: center;
  gap: 12px;
  padding: 14px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 50%;
}

.brand-mark img,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.18;
  white-space: nowrap;
}

.brand-ai {
  display: inline-block;
  padding: 0 4px;
  color: #0f7bbf;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.brand-acronym {
  color: #2d2b2b;
  font-weight: 900;
  font-size: 1.18em;
  letter-spacing: 0.02em;
}

.brand-expansion {
  font-weight: 650;
}

.brand-ai-word {
  color: #0f7bbf;
  font-weight: 900;
  font-size: 1.08em;
}

.nav-wide {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}

.nav-wide a {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  padding: 10px 12px 14px;
  color: #77716a;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
}

.nav-wide a span {
  white-space: nowrap;
}

.nav-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff8ee;
  border: 1px solid #f2d6bd;
  opacity: 0.92;
  overflow: hidden;
}

.nav-icon img {
  width: 30px;
  height: 30px;
  display: block;
}

.nav-wide a.active {
  color: var(--orange);
  font-weight: 700;
}

.nav-wide a.active::after {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--orange);
  content: "";
}

.profile {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
  color: #746f68;
  white-space: nowrap;
}

.coin-chip,
.school-chip,
.student-name {
  flex: 0 0 auto;
  white-space: nowrap;
}

.school-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.logout-btn {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid #f0c8a9;
  border-radius: 50%;
  color: #d15f20;
  background: #fff6ef;
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.logout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #d15f20;
}

.logout-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #d15f20;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  vector-effect: non-scaling-stroke;
}

.logout-icon svg path {
  stroke: #d15f20;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.logout-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-soft);
}

.shared-logout-dialog.hidden {
  display: none;
}

/* 彈窗打開時收起小詩仙浮動頭像：它在最上層，會擋住彈窗內容 */
body:has(.modal-overlay:not(.hidden), .shared-logout-dialog:not(.hidden), .shared-footer-dialog:not(.hidden)) xiaoshixian-widget {
  visibility: hidden;
}

.shared-logout-dialog {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.shared-logout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 31, 48, 0.42);
  backdrop-filter: blur(7px);
}

.shared-logout-card {
  position: relative;
  width: min(420px, calc(100vw - 40px));
  border-radius: 18px;
  padding: 28px;
  background: rgba(255, 253, 247, 0.98);
  box-shadow: 0 24px 70px rgba(31, 43, 64, 0.24);
  border: 1px solid rgba(218, 194, 156, 0.72);
  display: grid;
  gap: 16px;
  text-align: center;
}

.shared-logout-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 126, 51, 0.14);
  color: var(--orange);
  font-size: 26px;
  font-weight: 800;
}

.shared-logout-icon .logout-icon {
  width: 33px;
  height: 33px;
}

.shared-logout-icon .logout-icon svg {
  stroke-width: 2.35;
}

.shared-logout-copy h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.shared-logout-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.shared-logout-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.shared-logout-actions button {
  min-width: 116px;
  border-radius: 999px;
  border: 0;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.shared-logout-actions button:hover,
.shared-logout-actions button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.shared-logout-secondary {
  background: rgba(238, 231, 219, 0.9);
  color: var(--ink);
}

.shared-logout-primary {
  background: linear-gradient(135deg, var(--orange), var(--danger));
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 126, 51, 0.24);
}

.coin-chip {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #8a6b2f;
  background: rgba(255, 255, 255, 0.75);
}

.coin-chip.is-updated {
  animation: starPulse 0.45s ease;
}

@keyframes starPulse {
  0% {
    transform: scale(1);
    box-shadow: none;
  }
  45% {
    transform: scale(1.12);
    box-shadow: 0 10px 22px rgba(255, 185, 72, 0.35);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

/* 頂欄右上角：頭像和「我的」，點開「我的」頁 */
.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.profile-link:hover .student-name {
  color: #cb4d16;
}

.avatar {
  width: 50px;
  height: 50px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.page {
  height: 100%;
  min-height: 0;
  padding-top: 14px;
  overflow: hidden;
}

.screen-block {
  display: grid;
  height: 100%;
  min-height: 0;
  gap: 14px;
  overflow: hidden;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.app-shell.auth-mode {
  grid-template-rows: minmax(0, 1fr);
  padding: 12px;
}

.app-shell.auth-mode .topbar {
  display: none;
}

.login-screen {
  position: relative;
  display: block;
  height: 100%;
  padding: 14px 0 12px 0;
  border: 1px solid #ede2d2;
  border-radius: 26px;
  background:
    linear-gradient(90deg, rgba(249, 244, 235, 0) 56%, rgba(249, 244, 235, 0.82) 66%, rgba(249, 244, 235, 0.97) 75%, rgba(249, 244, 235, 0.995) 100%),
    url("./assets/login.webp") left center / cover no-repeat;
  overflow: hidden;
}

.login-brand strong {
  display: block;
  font-size: 50px;
  line-height: 1;
  color: #cb4d16;
  letter-spacing: 0.5px;
}

.login-brand small {
  display: block;
  margin-top: 8px;
  color: #5a554f;
  letter-spacing: 2px;
  font-size: 19px;
}

.login-card {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 2;
  width: 40%;
  min-width: 480px;
  max-width: 700px;
  display: grid;
  align-content: start;
  gap: 12px;
  margin-top: 0;
  padding: 30px 34px 24px;
  border: 1px solid #ece4d8;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.7), transparent 30%),
    #fcfcfd;
  box-shadow: 0 20px 45px rgba(120, 93, 63, 0.15);
}

.login-card-brand strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  color: #cb4d16;
}

.login-card-brand small {
  color: #5d5a56;
  letter-spacing: 1.5px;
  font-size: 15px;
}

.login-card h2 {
  margin-top: 4px;
  font-size: 58px;
  line-height: 1.05;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid #e9d8c6;
  border-radius: 999px;
  background: #fffdfb;
}

.role-btn {
  min-height: 50px;
  border-radius: 999px;
  color: #6f6660;
  font-size: 18px;
}

.role-btn.active {
  color: #d45d1f;
  border: 1px solid #f0c4a2;
  background: #fff4ec;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 17px;
  color: #5f584f;
}

.login-form input,
.login-form select {
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid #e5ddd2;
  border-radius: 14px;
  background: #fff;
  font-size: 20px;
}

.login-extra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5c5750;
  font-size: 18px;
}

.remember input {
  width: 20px;
  height: 20px;
}

.forgot-link {
  color: #e26d2d;
  font-size: 18px;
}

.login-error {
  min-height: 24px;
  color: #d55b34;
  font-size: 15px;
}

.hero-layout,
.teacher-main-grid,
.teacher-bottom-grid,
.bottom-layout,
.learn-layout-wide,
.split-panels {
  display: grid;
  gap: 14px;
}

.hero-layout {
  grid-template-columns: 1.45fr 1fr;
}

.bottom-layout {
  grid-template-columns: 1fr 1fr;
}

.teacher-main-grid {
  grid-template-columns: 1.45fr 1fr;
}

.teacher-bottom-grid {
  grid-template-columns: 1fr 1fr;
}

.learn-layout-wide {
  grid-template-columns: 1.75fr 1fr;
}

.split-panels {
  grid-template-columns: 1fr 1fr;
}

.stack {
  display: grid;
  gap: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
}

.panel-subtitle,
.meta,
.preview,
.mini-label,
.ghost-link {
  color: var(--muted);
}

.ghost-action,
.ghost-link {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}

.ghost-link {
  padding: 0;
  border: 0;
  background: none;
}

.map-panel {
  padding: 16px;
}

.map-art {
  position: relative;
  height: 450px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.12)),
    #f8f3e7;
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.98;
}

.map-node {
  position: absolute;
  display: grid;
  justify-items: center;
  width: 82px;
  transform: translate(-50%, -50%);
}

.node-pin {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 5px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.map-node.done .node-pin { background: var(--green); }
.map-node.active .node-pin { background: var(--orange); }
.map-node.locked .node-pin { background: #b9b2aa; }

.node-name {
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  font-weight: 700;
}

.node-stars,
.node-lock {
  margin-top: 4px;
  font-size: 12px;
  color: #f7b33d;
}

.map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.78);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

.dot.green { background: var(--green); }
.dot.orange { background: var(--orange); }
.dot.done { background: #4bb175; }
.dot.locked { background: #aaa39a; }

.recommend-panel,
.compact-panel,
.list-panel,
.assignment-panel,
.trend-panel,
.focus-panel,
.table-shell,
.score-panel,
.error-panel,
.mini-progress-panel,
.hero-poem,
.poem-lines-card,
.record-panel {
  padding: 16px;
}

.recommend-panel,
.assignment-panel,
.score-panel,
.error-panel,
.mini-progress-panel,
.trend-panel,
.focus-panel,
.table-shell {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.72), transparent 28%),
    rgba(255, 253, 248, 0.95);
}

.recommend-card,
.assignment-card,
.mini-progress-body,
.error-content,
.focus-head,
.speech-tip,
.hero-poem {
  display: grid;
  gap: 16px;
  align-items: center;
}

.recommend-card,
.assignment-card,
.mini-progress-body {
  grid-template-columns: 1fr 170px;
}

.hero-poem {
  grid-template-columns: 280px 1fr;
}

.recommend-art,
.assignment-card img,
.hero-poem-art,
.mini-progress-body img,
.poem-card img,
.unlock-card img {
  width: 100%;
  border-radius: 16px;
  object-fit: cover;
}

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

h1 {
  font-size: 28px;
  line-height: 1.3;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 18px;
}

.preview {
  margin-top: 10px;
  line-height: 1.75;
}

.study-progress,
.goal-line,
.progress-head,
.poem-progress-row,
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.study-progress {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f4e5d3;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #ffac6a);
}

.mini-stats,
.goal-grid,
.tool-grid,
.score-metrics {
  display: grid;
  gap: 12px;
}

.mini-stats {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.mini-stats div,
.goal-grid div,
.score-metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
  text-align: center;
}

.mini-stats span,
.goal-grid span,
.score-metric span,
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.mini-stats strong,
.goal-grid strong,
.score-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.goal-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.city-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.city-badges span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
}

.action-row,
.control-row,
.footer-links,
.pager,
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.action-row {
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  color: #fff;
  background: var(--orange);
}

.btn.secondary {
  color: #4b5563;
  border: 1px solid #e6dbcd;
  background: #fff;
}

.btn.success {
  color: #fff;
  background: #65c184;
}

.btn.wide {
  width: 100%;
}

.poem-cards,
.unlock-cards,
.focus-students {
  display: grid;
  gap: 14px;
}

.poem-cards {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.unlock-cards,
.focus-students {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
}

.poem-card,
.unlock-card,
.focus-card,
.tool-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  text-align: left;
}

.unlock-card {
  position: relative;
}

.poem-card.active {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(255,122,47,0.15) inset;
}

.poem-card-copy {
  display: grid;
  gap: 4px;
}

.play-chip,
.done-badge {
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.play-chip { background: var(--orange-soft); color: var(--orange); }
.done-badge { background: var(--green-soft); color: #56a76f; }

.breadcrumb {
  color: var(--muted);
  padding: 2px 4px;
}

.poem-lines-card .large-line-grid {
  display: grid;
  gap: 16px;
}

.line-block,
.focus-line {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.line-block {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,0.8);
}

.line-char,
.focus-char {
  text-align: center;
}

.line-char small,
.focus-char small {
  display: block;
  margin-bottom: 6px;
  color: #69635d;
  font-size: 12px;
}

.line-char span,
.focus-char span {
  font-size: 48px;
  line-height: 1;
}

.line-char.bad span,
.focus-char.bad span {
  color: var(--danger);
}

.line-audio-buttons {
  display: grid;
  gap: 12px;
  justify-items: end;
  margin-top: -138px;
  padding-right: 18px;
}

.line-audio-buttons button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--orange-soft);
}

.tabs-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}

.tab-item {
  display: grid;
  gap: 4px;
  padding: 14px 10px;
  color: #716b66;
  text-align: center;
  background: rgba(255,255,255,0.82);
}

.tab-item span {
  font-size: 13px;
  color: var(--muted);
}

.tab-item.active {
  color: var(--orange);
  background: rgba(255,244,236,0.95);
}

.speech-tip {
  grid-template-columns: 64px 1fr auto;
  margin-bottom: 14px;
}

.speech-tip img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.wave-row {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.wave {
  height: 42px;
  background:
    radial-gradient(circle, rgba(255,122,47,0.42) 2px, transparent 2px) center/18px 10px repeat-x;
  opacity: 0.65;
}

.record-button {
  width: 120px;
  height: 120px;
  justify-self: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #ffa24d, var(--orange));
  box-shadow: 0 18px 36px rgba(255, 122, 47, 0.26);
  font-size: 48px;
}

.record-button.recording {
  transform: scale(1.04);
}

.record-hint {
  color: var(--muted);
  text-align: center;
}

.pill-btn {
  flex: 1;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.poem-progress-row {
  margin-top: 14px;
}

.poem-progress {
  max-width: 260px;
}

.reward-tip {
  color: var(--orange);
}

.score-panel {
  text-align: center;
}

.score-title {
  color: var(--muted);
  font-size: 17px;
}

.score-big {
  margin-top: 8px;
  font-size: 84px;
  line-height: 1;
  color: var(--orange);
}

.score-big span {
  margin-left: 6px;
  font-size: 26px;
  color: var(--ink);
}

.stars {
  margin-top: 6px;
  font-size: 30px;
  color: #ffbe3c;
}

.score-note {
  margin: 8px 0 14px;
  font-size: 17px;
}

.score-note b {
  color: var(--orange);
}

.score-metrics {
  grid-template-columns: repeat(4, 1fr);
}

.score-metric .progress {
  margin-top: 10px;
}

.score-metric .progress.green span { background: var(--green); }
.score-metric .progress.blue span { background: var(--blue); }

.error-content {
  grid-template-columns: 1fr 120px;
  margin-top: 12px;
}

.error-content img {
  width: 100%;
  border-radius: 16px;
}

.error-text {
  font-size: 16px;
  line-height: 1.7;
}

.mini-progress-copy {
  display: grid;
  gap: 10px;
}

.mini-data {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.teacher-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-hero {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
}

.stat-value {
  margin-top: 8px;
  font-size: 48px;
  line-height: 1;
}

.stat-value span {
  margin-left: 6px;
  font-size: 18px;
}

.stat-note {
  margin-top: 8px;
  color: var(--muted);
}

.stat-ornament {
  display: grid;
  height: 82px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.15));
}

.stat-ornament span {
  font-size: 34px;
  opacity: 0.8;
}

.stat-hero.green .stat-value { color: #56a76f; }
.stat-hero.orange .stat-value { color: var(--orange); }
.stat-hero.blue .stat-value { color: var(--blue); }
.stat-hero.purple .stat-value { font-size: 28px; color: #8d54ac; }

.table-shell,
.table-toolbar {
  display: grid;
  gap: 16px;
}

.table-toolbar {
  grid-template-columns: 180px 1fr auto;
  margin-top: 10px;
}

.search-input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
}

.filter-pills span {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
}

.filter-pills .active {
  color: var(--orange);
  border-color: #f4c9aa;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.table th,
.table td {
  padding: 12px 14px;
  border-top: 1px solid #f3e8d8;
  text-align: left;
}

.table thead th {
  color: var(--muted);
  font-weight: 600;
}

.student-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-name img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.status {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.status.done {
  color: #5ba772;
  background: var(--green-soft);
}

.status.progress {
  color: var(--orange);
  background: var(--orange-soft);
}

.status.todo {
  color: #e06b52;
  background: #fff1ee;
}

.pager b,
.pager span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
}

.pager b {
  color: #fff;
  background: var(--orange);
}

.assignment-card {
  margin-top: 12px;
}

.assignment-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.assignment-meta span {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: #fff;
}

.problem-bars {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.problem-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 48px;
  gap: 12px;
  align-items: center;
}

.tool-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.tool-card {
  justify-items: center;
  text-align: center;
}

.tool-card span {
  font-weight: 700;
}

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

.trend-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  align-items: end;
  height: 210px;
  margin-top: 14px;
}

.chart-col {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.chart-col .bar {
  width: 36px;
  border-radius: 12px 12px 0 0;
  background: #f3dcc5;
}

.chart-col.current .bar {
  background: var(--orange);
}

.focus-students {
  grid-template-columns: repeat(4, 1fr);
}

.focus-card p {
  color: var(--muted);
  line-height: 1.7;
}

.focus-head {
  grid-template-columns: 64px 1fr;
}

.focus-head img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.focus-head strong,
.focus-head span {
  display: block;
}

.focus-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.footer-bar {
  display: grid;
  grid-template-columns: 250px 1fr 240px;
  align-items: center;
  gap: 14px;
  padding-top: 0;
}

.footer-note {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  color: var(--muted);
}

.footer-note img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.footer-links {
  justify-content: center;
  color: var(--muted);
}

.footer-slogan {
  text-align: right;
  color: #8f7d69;
}

.shared-footer-dialog.hidden {
  display: none;
}

.shared-footer-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.shared-footer-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 35, 24, 0.42);
  backdrop-filter: blur(3px);
}

.shared-footer-dialog-card {
  position: relative;
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: rgba(255, 252, 246, 0.98);
  border: 2px solid #eadcc5;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(64, 48, 24, 0.28);
  padding: 34px 40px 36px;
  color: #2d261b;
}

.shared-footer-dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff3df;
  color: #6d5a3a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.shared-footer-dialog-close:hover {
  background: #ffe3b6;
}

.shared-footer-dialog-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff1d8;
  color: #bb6b20;
  font-size: 28px;
  margin-bottom: 14px;
}

.shared-footer-dialog-card h2 {
  margin: 0 0 16px;
  font-size: 28px;
  color: #2d261b;
}

.shared-footer-dialog-body {
  font-size: 17px;
  line-height: 1.8;
  color: #514532;
}

.shared-footer-dialog-body p {
  margin: 0 0 12px;
}

.shared-footer-dialog-body h3 {
  margin: 20px 0 8px;
  font-size: 20px;
  color: #8f3a16;
}

.shared-footer-dialog-body ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.shared-footer-dialog-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.shared-footer-dialog-body li {
  margin: 6px 0;
}

.shared-footer-dialog-body dl {
  margin: 0 0 16px;
}

.shared-footer-dialog-body dt {
  margin-top: 10px;
  color: #2d261b;
  font-weight: 800;
}

.shared-footer-dialog-body dd {
  margin: 4px 0 0;
}

.shared-footer-dialog-body a {
  color: #0f7bbf;
  font-weight: 700;
}

.shared-footer-dialog-body .doc-note {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #eadcc5;
  border-radius: 8px;
  background: #fff7e8;
  color: #5b4b33;
}

body[data-density="compact"] .app-shell {
  grid-template-rows: 78px minmax(0, 1fr);
  padding: 0 14px 12px;
}

body[data-density="compact"] .login-screen {
  padding: 10px 0 10px 0;
}

body[data-density="compact"] .login-brand strong {
  font-size: 36px;
}

body[data-density="compact"] .login-brand small {
  font-size: 14px;
}

body[data-density="compact"] .login-card {
  width: 42%;
  min-width: 420px;
  max-width: 620px;
  right: 0;
  transform: translateY(-50%);
  padding: 22px 24px 18px;
}

body[data-density="compact"] .login-card-brand strong {
  font-size: 24px;
}

body[data-density="compact"] .login-card h2 {
  font-size: 44px;
}

body[data-density="compact"] .login-form label {
  font-size: 15px;
}

body[data-density="compact"] .login-form input,
body[data-density="compact"] .login-form select {
  min-height: 48px;
  font-size: 18px;
}

body[data-density="compact"] .remember,
body[data-density="compact"] .forgot-link {
  font-size: 15px;
}

body[data-density="compact"] .role-btn {
  min-height: 38px;
}

body[data-density="compact"] .topbar {
  grid-template-columns: 252px 1fr 228px;
  gap: 12px;
  padding: 10px 6px 10px;
}

body[data-density="compact"] .page,
body[data-density="compact"] .screen-block,
body[data-density="compact"] .hero-layout,
body[data-density="compact"] .teacher-main-grid,
body[data-density="compact"] .teacher-bottom-grid,
body[data-density="compact"] .bottom-layout,
body[data-density="compact"] .learn-layout-wide,
body[data-density="compact"] .split-panels {
  gap: 10px;
}

body[data-density="compact"] .brand strong {
  font-size: 22px;
}

body[data-density="compact"] .brand small,
body[data-density="compact"] .nav-wide a,
body[data-density="compact"] .meta,
body[data-density="compact"] .preview,
body[data-density="compact"] .panel-subtitle {
  font-size: 12px;
}

body[data-density="compact"] .brand-mark,
body[data-density="compact"] .avatar,
body[data-density="compact"] .speech-tip img,
body[data-density="compact"] .footer-note img {
  width: 48px;
  height: 48px;
}

body[data-density="compact"] .map-panel,
body[data-density="compact"] .recommend-panel,
body[data-density="compact"] .compact-panel,
body[data-density="compact"] .list-panel,
body[data-density="compact"] .assignment-panel,
body[data-density="compact"] .trend-panel,
body[data-density="compact"] .focus-panel,
body[data-density="compact"] .table-shell,
body[data-density="compact"] .score-panel,
body[data-density="compact"] .error-panel,
body[data-density="compact"] .mini-progress-panel,
body[data-density="compact"] .poem-lines-card,
body[data-density="compact"] .record-panel {
  padding: 12px;
}

body[data-density="compact"] .map-art {
  height: 390px;
}

body[data-density="compact"] .hero-poem {
  grid-template-columns: 248px 1fr;
}

body[data-density="compact"] .recommend-card,
body[data-density="compact"] .assignment-card,
body[data-density="compact"] .mini-progress-body {
  grid-template-columns: 1fr 144px;
}

body[data-density="compact"] .poem-cards,
body[data-density="compact"] .unlock-cards,
body[data-density="compact"] .focus-students {
  gap: 10px;
  margin-top: 10px;
}

body[data-density="compact"] .poem-card,
body[data-density="compact"] .unlock-card,
body[data-density="compact"] .focus-card,
body[data-density="compact"] .tool-card {
  padding: 8px;
  gap: 8px;
}

body[data-density="compact"] .line-char span,
body[data-density="compact"] .focus-char span {
  font-size: 42px;
}

body[data-density="compact"] .line-block {
  padding: 12px 16px;
}

body[data-density="compact"] .tabs-strip .tab-item {
  padding: 10px 8px;
}

body[data-density="compact"] .record-button {
  width: 108px;
  height: 108px;
  font-size: 42px;
}

body[data-density="compact"] .wave-row {
  grid-template-columns: 1fr 108px 1fr;
}

body[data-density="compact"] .score-big {
  font-size: 72px;
}

body[data-density="compact"] .stat-value {
  font-size: 40px;
}

body[data-density="compact"] .table th,
body[data-density="compact"] .table td {
  padding: 9px 10px;
  font-size: 13px;
}

body[data-density="compact"] .trend-chart {
  height: 170px;
  gap: 10px;
}

body[data-density="compact"] .footer-bar {
  grid-template-columns: 228px 1fr 218px;
  gap: 10px;
}

body[data-layout="narrow"] .hero-layout,
body[data-layout="narrow"] .teacher-main-grid,
body[data-layout="narrow"] .teacher-bottom-grid,
body[data-layout="narrow"] .bottom-layout,
body[data-layout="narrow"] .learn-layout-wide {
  grid-template-columns: 1.2fr 0.9fr;
}

body[data-layout="wide"] .hero-layout {
  grid-template-columns: 1.55fr 0.95fr;
}

body[data-layout="wide"] .teacher-main-grid {
  grid-template-columns: 1.5fr 0.92fr;
}
