.family-page {
  margin: 0;
  min-height: 100vh;
  background: #f4f8f6;
  color: #213732;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}
.family-portal {
  max-width: 720px;
  margin: auto;
  padding: 1.2rem 1rem 3rem;
}
.family-teacher {
  color: inherit;
}
.family-portal [hidden],
.family-teacher [hidden] {
  display: none !important;
}
.family-portal h1,
.family-portal h2,
.family-portal h3,
.family-teacher h2,
.family-teacher h3 {
  margin: 0 0 0.45rem;
  font-weight: 700;
}
.family-portal h1 {
  font-size: 1.8rem;
  line-height: 1.3;
}
.family-portal h2,
.family-teacher h2 {
  font-size: 1.2rem;
}
.family-portal h3,
.family-teacher h3 {
  font-size: 1rem;
}
.family-portal p,
.family-teacher p {
  margin: 0.25rem 0;
}
.family-top {
  padding: 0.65rem 0 0.3rem;
}
.family-card {
  background: #fff;
  border: 1px solid #dce8e2;
  border-radius: 1rem;
  padding: 1rem;
  margin: 0.7rem 0;
}
.family-teacher .family-card {
  color: #253b36;
}
.family-muted {
  color: #576b65;
  font-size: 0.88rem;
}
.family-status {
  min-height: 1.2em;
  color: #475f58;
  font-size: 0.88rem;
}
.family-status:empty {
  display: none;
}
.family-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.family-between {
  justify-content: space-between;
}
.family-field {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0.4rem 0;
  border: 1px solid #c8d9d2;
  background: #fff;
  color: #223932;
  border-radius: 0.65rem;
  padding: 0.63rem 0.7rem;
  font: inherit;
  font-size: 0.95rem;
}
.family-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  border: 1px solid #b8cec4;
  background: #fff;
  color: #25493b;
  border-radius: 0.6rem;
  padding: 0.48rem 0.8rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  min-height: 2.25rem;
  text-decoration: none;
  cursor: pointer;
}
.family-button.primary {
  background: #23694e;
  color: #fff;
  border-color: #23694e;
}
.family-button.danger {
  color: #a5334b;
  border-color: #e8c8d2;
}
.family-button:disabled {
  opacity: 0.55;
  cursor: default;
}
.family-button:focus-visible,
.family-field:focus-visible {
  outline: 2px solid #348265;
  outline-offset: 2px;
}
.family-form {
  display: grid;
  gap: 0.65rem;
  max-width: 420px;
}
.family-form label,
.family-select {
  font-size: 0.9rem;
  font-weight: 650;
}
.family-select {
  display: block;
}
.family-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.family-tabs [aria-current="true"] {
  background: #23694e;
  color: white;
  border-color: #23694e;
}
.family-row {
  padding: 0.7rem 0;
  border-top: 1px solid #e6efea;
}
.family-rows > :first-child {
  border-top: 0;
}
.family-qr {
  display: block;
  width: min(100%, 230px);
  height: auto;
  margin: 0.6rem 0;
}
.family-pet {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.8rem;
}
.family-pet-image {
  width: 116px;
  height: 116px;
  object-fit: contain;
  background: #f1f8f1;
  border-radius: 1rem;
}
.family-egg {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 1rem;
  background: #f1f8f1;
  font-size: 2.5rem;
}
.family-score {
  background: #eff7f2;
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
  margin: 0.4rem 0;
}
.family-section {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid #e6efea;
}
.family-copy {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.family-photo {
  display: block;
  width: min(100%, 460px);
  height: auto;
  border-radius: 0.6rem;
}
@media (max-width: 480px) {
  .family-portal {
    padding: 0.85rem 0.7rem 2rem;
  }
  .family-card {
    padding: 0.8rem;
  }
}

/* Class invitation binding follows the supplied parent-page flow; business
   tabs stay intact. These styles affect only the invitation form. */
.family-binding-banner {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(120deg, #edf5ff, #fff9df);
  color: #24344d;
  margin-bottom: 18px;
}
.family-binding-banner h2 {
  margin: 6px 0;
  font-size: 24px;
}
.family-binding-banner p {
  color: #64748b;
  margin: 0;
}
#family-bind {
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 32px #477eb915;
}
#family-bind .family-button.primary {
  width: 100%;
  padding: 14px;
  border: 0;
  background: linear-gradient(110deg, #6fa9ed, #397df3);
  border-radius: 16px;
  color: white;
  font-size: 18px;
}
#family-bind .family-field {
  background: #f8faff;
  border-color: #dce3ef;
  border-radius: 12px;
  padding: 13px;
}
.family-consent {
  display: flex !important;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  line-height: 1.6;
}
.family-consent input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 3px;
}
#family-bind [hidden] {
  display: none !important;
}
#family-binding-privacy {
  padding: 12px;
  background: #f5f9ff;
  border-radius: 12px;
  color: #64748b;
  font-size: 13px;
}

/* Parent H5 shell follows the supplied five-tab flow. These rules never style
   the teacher application or its original selector. */
.family-page {
  background: linear-gradient(180deg, #e2efff 0, #f5faff 75%);
  color: #24344d;
}
.family-page * {
  box-sizing: border-box;
}
.family-portal {
  max-width: 760px;
  padding-bottom: 110px;
  overflow-wrap: anywhere;
}
.family-page .family-card {
  border-color: #e9eff6;
  border-radius: 22px;
  box-shadow: 0 8px 24px #487eae08;
}
.family-page .family-muted {
  color: #7d899b;
  line-height: 1.7;
}
.family-page .family-button {
  border-color: #e3eaf5;
  border-radius: 14px;
  color: #55779c;
  min-height: 42px;
}
.family-page .family-button.primary {
  background: linear-gradient(110deg, #71acee, #397ef3);
  border: 0;
  color: white;
}
.family-page .family-field {
  border-color: #dfe6f1;
  color: #24344d;
}
.family-top h1 {
  font-size: 22px;
}
.family-top > div > p {
  font-size: 12px;
}
.family-select {
  background: #ffffffc9;
}
.family-select select {
  margin-bottom: 0;
}
.family-tabs {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  background: #ffffffed;
  backdrop-filter: blur(16px);
  margin: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #e7edf7;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 24px #487eae0a;
}
.family-tabs .family-button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: transparent;
  border: 0;
  color: #939ba8;
  font-size: 14px;
  padding: 5px 0;
  min-width: 0;
}
.family-nav-icon {
  font-size: 25px;
  line-height: 1.2;
}
.family-tabs [aria-current="true"] {
  background: #eaf3ff;
  color: #4a88d0;
}
.family-pet {
  position: relative;
  min-height: 290px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  background:
    radial-gradient(ellipse at 50% 90%, #d7edc1 0, transparent 45%),
    linear-gradient(155deg, #e0f3ff, #f2fbec 65%, #fff7df);
  padding: 22px;
  text-align: center;
}
.family-pet-image,
.family-egg {
  height: 200px;
  width: 200px;
  background: transparent;
  border-radius: 20px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px #477a771c);
}
.family-pet h2 {
  font-size: 21px;
}
.family-pet .family-muted {
  font-size: 13px;
}
.family-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.family-quick .family-button {
  background: #def3e5;
  color: #426956;
  min-height: 56px;
  font-size: 15px;
  border: 0;
}
.family-quick .family-button:nth-child(2) {
  background: #fff0bd;
  color: #8a774b;
}
.family-quick .family-button:nth-child(3) {
  grid-column: 1/-1;
  background: #fff5db;
  color: #88724e;
}
.family-balances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.family-balances .family-row {
  border: 0;
  background: #f8f8f2;
  padding: 18px;
  border-radius: 18px;
}
.family-balances strong {
  color: #9297a1;
  font-size: 14px;
}
.family-balances p {
  font-size: 30px;
  font-weight: 750;
  color: #24344d !important;
  line-height: 1.4;
}
.family-banner {
  font-size: 26px;
  font-weight: 750;
  padding: 28px 18px;
  border-radius: 20px;
  background: linear-gradient(110deg, #fff8df, #e6f4ff);
  margin-bottom: 16px;
}
.family-row {
  border-color: #edf1f7;
  padding: 16px 0;
}
.family-copy {
  line-height: 1.8;
  color: #66758c;
}
.family-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.family-product-grid .family-row {
  min-width: 0;
  border: 1px solid #e8eef7;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.family-product-grid .family-row > p {
  font-size: 13px;
}
.family-product-grid .family-button {
  margin-top: auto;
}
.family-product-image {
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: #f8faff;
  border-radius: 12px;
}
.family-product-emoji {
  font-size: 52px;
  display: block;
  text-align: center;
  padding: 18px;
}
.family-menu {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.family-menu .family-button {
  justify-content: space-between;
  text-align: left;
  min-height: 54px;
}
.family-house-scene {
  position: relative;
  margin: 20px 0;
  border-radius: 20px;
  overflow: hidden;
  background: #fff8e8;
}
.family-room {
  display: block;
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
}
.family-resident {
  position: absolute;
  bottom: 6%;
  left: 35%;
  width: 30%;
  height: 50%;
  object-fit: contain;
}
@media (min-width: 700px) {
  .family-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .family-pet {
    min-height: 350px;
  }
  .family-pet-image {
    height: 240px;
    width: 240px;
  }
}

/* Parent home uses the same percentage/slot layout as the teacher view. */
.family-house-furniture {
  position: absolute;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.family-resident {
  z-index: 4;
}
.family-product-grid select,
.family-product-grid input {
  max-width: 100%;
  box-sizing: border-box;
}
.family-product-grid label {
  display: block;
  font-size: 13px;
}
.family-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.family-learning-dialog{box-sizing:border-box;border:1px solid #ded5ee;border-radius:24px;background:#faf8ff;color:#353052;padding:16px;width:min(600px,94vw);height:min(860px,92dvh);max-height:92vh}.family-learning-dialog::backdrop{background:#35305266}.family-learning-dialog>button{float:right}.family-learning-dialog>h2{font-size:19px;margin:8px 0 16px}.family-learning-frame{display:block;width:100%;height:calc(100% - 68px);border:0;border-radius:16px;background:#edf3ed}

.family-task-planner select,.family-task-planner input{max-width:100%;padding:10px;border:1px solid #d9e4dc;border-radius:12px;font:inherit}.family-task-planner label{display:inline-flex;gap:8px;flex-wrap:wrap;align-items:center;margin:8px}.family-task-planner .family-button{min-height:44px;margin:6px}.family-task-course{padding:16px;margin:12px 0;border:1px solid #dce5db;border-radius:18px;background:#fff9}.family-task-course h3{font-size:16px}.family-task-confirm{border:1px solid #dce5db;border-radius:22px;max-width:calc(100vw - 32px);width:420px}.family-task-confirm::backdrop{background:#253b3266}

.family-task-planner .family-course-options{max-height:48vh;overflow-y:auto;overscroll-behavior:contain;border-radius:18px;margin:14px 0}.family-task-planner form{padding:14px;background:#f0f6f2;border-radius:18px;margin:14px 0}
