:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.13);
  --soft: #f2f2f7;
  --paper: rgba(255, 255, 255, 0.78);
  --mint: #e7f4ee;
  --mint-strong: #2f7d5b;
  --sky: #e8f2ff;
  --sky-strong: #0a84ff;
  --coral: #fff0eb;
  --coral-strong: #ff6b4a;
  --gold: #fff5d6;
  --success: #248a3d;
  --danger: #d70015;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.07);
  --radius: 8px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -18%, rgba(10, 132, 255, 0.1), transparent 34%),
    linear-gradient(180deg, #fbfbfd 0%, #f2f2f7 42%),
    var(--soft);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(242, 242, 247, 0.76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(180%);
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #2b2b2f, #111113);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.1;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.home-page {
  width: min(1680px, calc(100% - 28px));
  flex: 1;
  display: grid;
  align-content: start;
  gap: 18px;
  padding-top: 18px;
}

.band {
  width: 100%;
  padding: 24px clamp(16px, 4vw, 48px);
}

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

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
}

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

.panel,
.card,
.modal-box {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(160%);
}

.panel {
  border-radius: var(--radius);
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.section-head h3,
.panel h2,
.panel h3 {
  margin: 0;
}

.hint,
.small {
  color: var(--muted);
}

.hint {
  margin: 5px 0 0;
  font-size: 15px;
  line-height: 1.55;
}

.small {
  font-size: 13px;
}

.button,
.icon-button,
.choice,
.pill {
  min-height: 42px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.button {
  padding: 10px 15px;
  background: #0a84ff;
  color: #fff;
  font-weight: 750;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-color: var(--line);
}

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

.button.success {
  background: #0a84ff;
}

.button.warning {
  background: var(--coral-strong);
}

.button:hover,
.icon-button:hover,
.choice:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border-color: var(--line);
}

.tabs,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.segmented button {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
}

.tab.active,
.segmented button.active {
  background: #1d1d1f;
  color: #fff;
  border-color: #1d1d1f;
}

.parent-mode-button {
  min-width: 104px;
}

.parent-tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px) saturate(160%);
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(680px, 1.55fr) minmax(360px, 0.45fr);
  gap: 18px;
  align-items: start;
}

.calendar-panel {
  min-height: calc(100vh - 210px);
}

.home-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.58fr);
  gap: 18px;
  align-items: end;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(22px) saturate(160%);
}

.home-overview h2 {
  margin: 8px 0 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.05;
}

.home-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.home-kpis > div {
  min-width: 0;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.76);
}

.home-kpis b {
  display: block;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.home-kpis span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.today-column {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 88px;
  align-self: start;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-legend span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0a84ff;
}

.calendar-legend i.primary,
.child-dot.primary {
  background: #34c759;
}

.calendar-legend i.middle,
.child-dot.middle {
  background: #0a84ff;
}

.calendar-legend i.custom,
.child-dot.custom {
  background: #5e5ce6;
}

.eyebrow {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 750;
}

.child-card {
  min-height: 178px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(18px) saturate(150%);
}

.child-card.primary {
  background: rgba(255, 255, 255, 0.8);
}

.child-card.middle {
  background: rgba(255, 255, 255, 0.8);
}

.child-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.kid-avatar {
  width: 76px;
  min-height: 76px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-self: start;
  font-size: 28px;
  font-weight: 760;
  color: #fff;
  background: linear-gradient(160deg, #34c759, #0a84ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.child-card.middle .kid-avatar {
  background: linear-gradient(160deg, #0a84ff, #5e5ce6);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.stat-strip > div {
  min-width: 0;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.76);
}

.stat-strip b {
  display: block;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1;
}

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

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.pill {
  min-height: 34px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.64);
  border-color: var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

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

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: #0a84ff;
}

.task-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.task-chip-row span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  padding: 5px 9px;
  background: #f2f2f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.weekday {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.day {
  min-height: 132px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.day.empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.day.today {
  border: 2px solid #0a84ff;
}

.day.done {
  background: #eef8f2;
}

.day.partial {
  background: #fff8e6;
}

.day-number {
  font-weight: 900;
}

.day-status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.day-family {
  display: grid;
  gap: 6px;
}

.day-child {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.day-child span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

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

.task-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.task-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #f2f2f7;
  color: #0a84ff;
  font-weight: 900;
}

.learning-shell {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-rows: auto 1fr;
}

.learn-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.word-card {
  min-height: 420px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: clamp(22px, 5vw, 54px);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(160%);
}

.word {
  font-size: clamp(44px, 8vw, 92px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.phonetic {
  font-size: clamp(18px, 3vw, 28px);
  color: var(--muted);
}

.translation {
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 850;
}

.example {
  width: min(760px, 100%);
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #f5f5f7;
  border: 1px solid var(--line);
  font-size: clamp(17px, 2.4vw, 23px);
  line-height: 1.55;
}

.choices {
  width: min(780px, 100%);
  display: grid;
  gap: 12px;
}

.choice {
  justify-content: flex-start;
  width: 100%;
  min-height: 62px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-color: var(--line);
  text-align: left;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 800;
}

.choice.correct {
  background: #eef8f2;
  border-color: var(--success);
  color: var(--success);
}

.choice.wrong {
  background: #fff0eb;
  border-color: var(--danger);
  color: var(--danger);
}

.spell-box {
  width: min(640px, 100%);
  display: grid;
  gap: 12px;
}

.spell-assist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.spell-assist > div {
  display: grid;
  gap: 3px;
  text-align: left;
}

.letter-hints {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 4px;
}

.letter-hints span {
  width: 34px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f5f5f7;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-transform: lowercase;
}

.spell-box input {
  width: 100%;
  min-height: 70px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 850;
  text-align: center;
  letter-spacing: 0;
}

.feedback {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.feedback.good {
  color: var(--success);
}

.feedback.bad {
  color: var(--danger);
}

.session-report {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-metric {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f5f5f7;
  border: 1px solid var(--line);
}

.report-metric b {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
}

.report-metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.weak-list {
  width: min(720px, 100%);
  display: grid;
  gap: 8px;
  text-align: left;
}

.weak-list h3 {
  margin: 0;
  font-size: 17px;
}

.weak-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(245, 245, 247, 0.88);
  border: 1px solid var(--line);
}

.weak-item strong,
.weak-item span {
  display: block;
}

.weak-item strong {
  font-size: 18px;
}

.weak-item span {
  color: var(--muted);
}

.weak-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.weak-tags span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.round {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 800;
}

.round.active {
  color: #fff;
  background: #0a84ff;
  border-color: #0a84ff;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.parent-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.stat {
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.stat b {
  display: block;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.05;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.table th {
  background: #f5f5f7;
  font-size: 13px;
  color: var(--muted);
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.settings-card h3 {
  margin: 0;
}

.add-child-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(220px, 1.2fr) repeat(4, minmax(150px, 0.8fr));
  gap: 12px;
  align-items: end;
}

.sync-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(180px, 0.7fr) minmax(180px, 0.7fr);
  gap: 12px;
  align-items: end;
}

.sync-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-badge {
  max-width: 360px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.sync-badge.ready {
  background: #eef8f2;
  color: var(--success);
}

.sync-badge.pending,
.sync-badge.syncing {
  background: #fff8e6;
  color: #8a6300;
}

.sync-badge.error {
  background: #fff0eb;
  color: var(--danger);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}

.field input,
.field select {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 8px 10px;
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 29, 31, 0.32);
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: min(460px, 100%);
  border-radius: var(--radius);
  padding: 22px;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.confetti span {
  position: absolute;
  top: -20px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  animation: fall 900ms ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(260deg);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .home-page {
    width: min(100% - 20px, 1180px);
  }

  .home-overview {
    grid-template-columns: 1fr;
  }

  .home-kpis {
    grid-template-columns: 1fr;
  }

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

  .calendar-panel {
    min-height: auto;
  }

  .today-column {
    position: static;
  }

  .calendar-legend {
    justify-content: flex-start;
  }

  .grid.two,
  .grid.three,
  .settings-grid,
  .stat-grid,
  .add-child-form,
  .sync-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .calendar {
    gap: 5px;
  }

  .day {
    min-height: 116px;
    padding: 6px;
  }

  .day-status {
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .child-card {
    grid-template-columns: 1fr;
  }

  .kid-avatar {
    width: 64px;
    min-height: 64px;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }

  .session-report,
  .weak-item {
    grid-template-columns: 1fr;
  }

  .weak-tags {
    justify-content: flex-start;
  }

  .task-item {
    grid-template-columns: 34px 1fr;
  }

  .task-item .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .word-card {
    min-height: 380px;
  }

  .letter-hints {
    gap: 5px;
  }

  .letter-hints span {
    width: 28px;
    height: 34px;
    font-size: 17px;
  }
}
