:root {
  --ink: #24304f;
  --muted: #6b7390;
  --line: #e8dff6;
  --panel: rgba(255, 255, 255, 0.92);
  --bg: #fff7d8;
  --pink: #ff83b6;
  --rose: #ff5b8f;
  --blue: #5aa7ff;
  --sky: #bfeaff;
  --violet: #8b7cff;
  --mint: #7addb2;
  --yellow: #ffd94d;
  --orange: #ffac4d;
  --shadow: 0 18px 42px rgba(83, 69, 146, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 217, 77, 0.55) 0 90px, transparent 92px),
    radial-gradient(circle at 86% 20%, rgba(191, 234, 255, 0.9) 0 120px, transparent 122px),
    linear-gradient(135deg, #fff2c5 0%, #ffe0ef 44%, #d8f3ff 100%);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 28%, rgba(255, 255, 255, 0.85) 0 70px, transparent 72px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.75) 0 90px, transparent 92px),
    linear-gradient(135deg, #9edcff, #ffd4e6 48%, #fff0a8);
}

.storybook-cloud {
  position: absolute;
  width: 150px;
  height: 56px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  filter: blur(0.2px);
}

.storybook-cloud::before,
.storybook-cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.storybook-cloud::before {
  width: 70px;
  height: 70px;
  left: 22px;
  top: -30px;
}

.storybook-cloud::after {
  width: 88px;
  height: 88px;
  right: 18px;
  top: -44px;
}

.cloud-a {
  left: 8%;
  top: 18%;
}

.cloud-b {
  right: 9%;
  bottom: 14%;
}

.auth-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 4px solid #fff;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 18px;
}

.role-tabs,
.auth-tabs {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.role-tabs {
  grid-template-columns: repeat(2, 1fr);
}

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

.role-tab,
.auth-tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 8px;
  color: #5f4e86;
  background: #f2eaff;
  font-weight: 800;
}

.role-tab.active,
.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--violet));
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.class-card {
  min-height: 72px;
  border: 3px solid #fff;
  border-radius: 20px;
  color: #493d78;
  background: linear-gradient(135deg, #fff, #fff5ca);
  box-shadow: 0 10px 22px rgba(83, 69, 146, 0.12);
  font-size: 17px;
  font-weight: 900;
}

.class-card:hover,
.class-card.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--rose));
  transform: translateY(-1px);
}

.class-select-card {
  width: min(620px, 100%);
}

.auth-form,
.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form {
  gap: 13px;
}

.auth-form span {
  color: var(--muted);
  font-weight: 700;
}

.auth-form input {
  border: 2px solid #eadcf8;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.app-shell.locked {
  filter: blur(4px);
  pointer-events: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 217, 77, 0.35), transparent 35%),
    linear-gradient(180deg, #6d6aff, #ff77ad);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  line-height: 1;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--yellow), #fff6b7);
  color: #7c4a00;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(116, 79, 0, 0.18);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  margin-top: 3px;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  text-align: left;
  font-weight: 800;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.icon {
  width: 24px;
  text-align: center;
  color: var(--yellow);
}

.account-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  padding-top: 18px;
}

.account-panel > span {
  display: block;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  margin-bottom: 10px;
}

main {
  padding: 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: #d33f86;
  font-weight: 900;
  margin: 0 0 6px;
}

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

h1 {
  font-size: 30px;
  line-height: 1.25;
  margin-bottom: 0;
}

h2 {
  font-size: 19px;
  margin-bottom: 0;
}

.status-pill,
.review-badge {
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff6b7;
  color: #8b6200;
  border: 2px solid #fff;
  font-size: 14px;
  font-weight: 800;
}

.kid-layout,
.teacher-layout {
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
  gap: 18px;
  min-width: 0;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}

.roster-panel {
  margin-bottom: 18px;
}

.roster-add {
  display: flex;
  gap: 10px;
  align-items: center;
}

.roster-add input,
.roster-item input {
  min-width: 0;
  border: 2px solid #eadcf8;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
}

.roster-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.roster-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 2px solid #fff;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.roster-name-btn {
  min-width: 0;
  border: 0;
  border-radius: 16px;
  padding: 10px 12px;
  color: #fff;
  text-align: left;
  background: linear-gradient(135deg, #ff77ad, #6aa8ff);
  box-shadow: 0 10px 20px rgba(106, 90, 205, 0.18);
}

.roster-name-btn strong,
.roster-name-btn small {
  display: block;
}

.roster-name-btn strong {
  font-size: 16px;
}

.roster-name-btn small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.roster-menu-btn {
  border-color: #e7d6ff;
  color: var(--violet);
  background: #fff;
}

.roster-actions {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding-top: 4px;
}

.roster-actions.open {
  display: grid;
}

.danger-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #d93d72);
  font-weight: 900;
}

.student-home {
  display: grid;
  grid-template-columns: minmax(180px, 34%) 1fr;
  gap: 16px;
}

.student-calendar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.calendar-item {
  border: 2px solid #fff;
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 4px 10px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(122, 103, 177, 0.12);
}

.calendar-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(90, 167, 255, 0.14);
}

.calendar-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--rose));
  font-weight: 900;
}

.calendar-item small {
  color: var(--muted);
}

.student-dialogue h3 {
  margin-top: 0;
}

.child-card {
  min-width: 0;
  border: 2px solid #fff;
  background: #fff;
  border-radius: 22px;
  min-height: 112px;
  padding: 12px;
  display: grid;
  gap: 8px;
  justify-items: center;
  box-shadow: 0 8px 20px rgba(122, 103, 177, 0.13);
}

.child-card.active {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(139, 124, 255, 0.18);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #5d4a80;
  font-weight: 900;
  border: 3px solid #fff;
}

.avatar.mini {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  font-size: 13px;
}

.child-name {
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.selected-child {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
}

.selected-child strong {
  display: block;
  color: var(--ink);
}

.upload-zone {
  position: relative;
  min-height: 230px;
  border: 3px dashed #ff9fc7;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.74);
  margin-bottom: 14px;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.upload-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #bf3272;
  font-weight: 900;
}

.upload-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff0a8;
  font-size: 34px;
  color: #9d6b00;
}

#artPreview {
  display: none;
  width: 100%;
  height: 280px;
  object-fit: contain;
  background: #fff;
}

.talk-box textarea,
.report-editor textarea,
.teacher-note textarea {
  width: 100%;
  border: 2px solid #eadcf8;
  border-radius: 18px;
  resize: vertical;
  padding: 13px;
  color: var(--ink);
  background: #fff;
}

.talk-actions,
.publish-row,
.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.primary-btn,
.quiet-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.primary-btn {
  background: linear-gradient(135deg, var(--rose), var(--violet));
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 91, 143, 0.28);
}

.quiet-btn {
  background: #fff;
  color: var(--violet);
  border: 2px solid #e5d9ff;
}

.ghost-btn {
  background: #fff8cd;
  color: #8b6200;
  border: 2px solid #fff;
}

.conversation {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.message {
  border-radius: 20px;
  padding: 12px;
  border: 2px solid #fff;
  background: #fff;
}

.message.ai {
  background: #eef7ff;
  border-color: #cbe8ff;
}

.message-role {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 800;
}

.message p {
  margin-bottom: 0;
  line-height: 1.6;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #fff;
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  font-size: 30px;
  font-weight: 900;
  color: var(--violet);
}

.metric small {
  color: var(--muted);
  font-weight: 800;
}

select {
  border: 2px solid #eadcf8;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.record-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.record-item {
  border: 2px solid #fff;
  border-radius: 20px;
  background: #fff;
  padding: 13px;
  text-align: left;
}

.record-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(90, 167, 255, 0.14);
}

.record-item strong {
  display: block;
  margin-bottom: 5px;
}

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

.record-detail {
  min-height: 520px;
}

.detail-image {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 2px solid #fff;
  border-radius: 20px;
  background: #fff;
  margin: 12px 0;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tag {
  border-radius: 999px;
  background: #eef1ff;
  color: #5c50c8;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.teacher-note {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.teacher-report {
  margin-top: 18px;
}

.report-editor {
  max-width: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  background: #5d4a80;
  color: #fff;
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-tabs,
  .metrics,
  .kid-layout,
  .teacher-layout,
  .student-home {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .roster-add,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  main,
  .sidebar {
    padding: 16px;
    width: 100%;
    max-width: 100vw;
  }

  h1 {
    font-size: 23px;
  }

  .children-grid,
  .class-grid,
  .role-tabs,
  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .primary-btn,
  .quiet-btn,
  .ghost-btn,
  .roster-add input,
  select {
    width: 100%;
    justify-content: center;
  }

  .roster-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .roster-item .quiet-btn {
    grid-column: 1 / -1;
  }

  .roster-actions {
    grid-template-columns: 1fr;
  }
}
