:root {
  --family-paper: #f3eee5;
  --family-ink: #202326;
  --family-blue: #bdcedf;
  --family-yellow: #fae377;
  --family-red: #e9a891;
  --family-green: #c1d2ad;
  --family-line: 2px solid #272728;
}
.family-child [hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  .family-parent .savebar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .family-parent .savebar button {
    white-space: nowrap;
    flex: 1;
    font-size: 16px;
  }
  .family-parent .savebar #save-status {
    flex-basis: 100%;
  }
}
.family-page {
  margin: 0;
  background: var(--family-paper);
  color: var(--family-ink);
  font:
    800 20px/1.5 system-ui,
    -apple-system,
    "Noto Sans TC",
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
.family-page * {
  box-sizing: border-box;
}
.family-page a {
  color: inherit;
}
.family-page button,
.family-page input,
.family-page select {
  font: inherit;
  color: inherit;
}
.family-page button,
.family-page .button {
  min-height: 48px;
  padding: 10px 18px;
  border: var(--family-line);
  border-radius: 3px;
  background: #fffaf2;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.family-page button:disabled {
  opacity: 0.45;
  cursor: default;
}
.family-page button[aria-pressed="true"],
.family-page .primary {
  background: #263d55;
  color: #fff;
}
.family-page :focus-visible,
.family-child :focus-visible {
  outline: 4px solid #2e67a0;
  outline-offset: 4px;
}
.family-page h1,
.family-page h2,
.family-page h3,
.family-page p {
  margin: 0;
}
.family-page h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
}
.family-page h2 {
  font-size: 28px;
}
.family-page h3 {
  font-size: 22px;
}
.family-page small,
.family-page .muted {
  font-size: 15px;
  font-weight: 600;
  color: #59616b;
}
.family-page input:not([type="checkbox"]):not([type="radio"]),
.family-page select {
  border: var(--family-line);
  background: #fff;
  min-height: 48px;
  padding: 8px;
  max-width: 100%;
  border-radius: 3px;
}
.family-page input[type="checkbox"],
.family-page input[type="radio"] {
  width: 22px;
  height: 22px;
  accent-color: #263d55;
}
.family-shell {
  max-width: 1060px;
  padding: 36px 32px 60px;
  margin: auto;
}
.family-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.family-person {
  display: flex;
  align-items: center;
  gap: 16px;
}
.family-avatar {
  width: 80px;
  height: 80px;
  border: var(--family-line);
  border-radius: 20px;
  object-fit: cover;
}
.family-header .family-stats-link {
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 18px;
}
.family-hero {
  background: var(--family-blue);
  border: var(--family-line);
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  min-height: 205px;
}
.family-hero h2 {
  font-size: 48px;
  line-height: 1.15;
}
.family-hero p {
  margin: 12px 0 20px;
  font-size: 23px;
}
.family-hero .family-mark {
  font-size: 100px;
  line-height: 1;
  color: #354e67;
  min-width: 140px;
  text-align: center;
  letter-spacing: -12px;
}
.family-tasks {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.family-task {
  display: flex;
  align-items: center;
  gap: 16px;
  border: var(--family-line);
  padding: 18px;
  background: #fffaf2;
  text-decoration: none;
}
.family-task strong {
  flex: 1;
}
.family-task .count {
  font-size: 18px;
}
.family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.family-tile {
  border: var(--family-line);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  text-decoration: none;
  min-height: 135px;
}
.family-tile strong {
  font-size: 32px;
}
.family-tile .symbol {
  font-size: 44px;
  line-height: 1;
  letter-spacing: -3px;
}
.family-tile:nth-child(4n + 1) {
  background: var(--family-yellow);
}
.family-tile:nth-child(4n + 2) {
  background: #bcd7ee;
}
.family-tile:nth-child(4n + 3) {
  background: var(--family-red);
}
.family-tile:nth-child(4n) {
  background: var(--family-green);
}
.family-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
}
.family-footer a {
  text-underline-offset: 5px;
}
.family-panel {
  border: var(--family-line);
  padding: 24px;
  background: #fffaf2;
  margin: 20px 0;
}
.family-panel > h2 {
  margin-bottom: 16px;
}
.family-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.family-metric strong {
  font-size: 42px;
  line-height: 1.1;
}
.family-metric span {
  display: block;
  font-size: 17px;
}
.family-detail {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
}
.family-detail th,
.family-detail td {
  text-align: left;
  padding: 12px 6px;
  border-bottom: 1px solid #ccc;
}
.family-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}
.family-badge {
  padding: 28px 12px 16px;
  text-align: center;
  border: var(--family-line);
  background: #fff;
}
.family-badge.locked {
  opacity: 0.4;
  filter: grayscale(1);
}
.family-badge strong {
  display: block;
  font-size: 18px;
  margin-top: 12px;
}
.family-brick {
  display: inline-block;
  width: 68px;
  height: 42px;
  background: #f1ca47;
  position: relative;
  border: 2px solid #413d32;
  box-shadow: inset -6px -7px #0002;
  margin-top: 10px;
}
.family-brick:before,
.family-brick:after {
  content: "";
  position: absolute;
  top: -12px;
  width: 19px;
  height: 12px;
  background: inherit;
  border: 2px solid #413d32;
  border-bottom: 0;
}
.family-brick:before {
  left: 8px;
}
.family-brick:after {
  right: 8px;
}
.family-brick.blue {
  background: #96b9db;
}
.family-brick.red {
  background: #dc9988;
}
.family-brick.green {
  background: #a8c38b;
}
.family-brick.purple {
  background: #beafd1;
}
.family-reward {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: #fff9ed;
  color: #202326;
  border: var(--family-line);
  padding: 20px;
  box-shadow: 8px 8px #202326;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: calc(100vw - 40px);
  font: 800 20px/1.3 system-ui;
}
.family-reward .family-brick {
  flex-shrink: 0;
  animation: brick-in 0.45s ease-out;
}
.family-reward a,
.family-reward button {
  color: inherit;
  font: inherit;
  white-space: nowrap;
  padding: 10px;
  border: var(--family-line);
  background: #bdcedf;
  cursor: pointer;
}
.family-reward button {
  background: white;
}
.family-notice {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 9999;
  border: 2px solid #8a6630;
  background: #fff5db;
  color: #563b12;
  padding: 10px;
  font: 700 16px/1.4 system-ui;
}
.family-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.family-stack {
  display: grid;
  gap: 14px;
}
.family-field {
  display: grid;
  gap: 6px;
}
.family-parent {
  font-size: 17px;
}
.family-parent .family-shell {
  max-width: 960px;
}
.family-parent .family-avatar {
  width: 100px;
  height: 100px;
}
.family-parent .avatar-choice {
  display: grid;
  gap: 8px;
  padding: 8px;
}
.family-parent label {
  cursor: pointer;
}
.family-parent .app-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #cecac3;
}
.family-parent .app-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.family-parent .app-row button {
  padding: 4px 12px;
}
.family-parent .savebar {
  position: sticky;
  bottom: 0;
  background: var(--family-paper);
  border-top: var(--family-line);
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 2;
}
.family-parent .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.family-parent #save-status {
  font-size: 15px;
}
.family-child {
  background: var(--family-paper) !important;
  color: var(--family-ink);
  font-weight: 700;
}
.family-child button,
.family-child input,
.family-child select {
  font-weight: 800;
}
.family-child h1,
.family-child h2,
.family-child h3 {
  font-weight: 900;
}
.family-child .family-appbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 20px;
  font: 800 18px/1.4 system-ui;
}
.family-appbar a {
  color: #263d55;
  text-decoration: none;
  padding: 10px 14px;
  border: var(--family-line);
  background: #fffaf2;
}
.family-appbar img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  vertical-align: middle;
  margin-right: 8px;
}
.family-child .family-parent-only,
.family-child #child-badge {
  display: none !important;
}
.family-child .family-task-hint {
  font: 800 17px/1.4 system-ui;
  color: #344a5c;
}
.family-child .family-self-spelling {
  max-width: 720px;
  margin: 20px auto;
  background: #fffaf2;
  border: var(--family-line);
  padding: 32px;
}
.family-self-spelling input {
  font: 800 30px/1.5 system-ui;
  max-width: 100%;
  padding: 12px;
  border: var(--family-line);
  background: white;
}
.family-self-spelling button {
  min-height: 52px;
  font: 800 20px/1.4 system-ui;
  padding: 12px 20px;
  border: var(--family-line);
  background: #bdcedf;
  margin: 8px 8px 8px 0;
}
.family-self-spelling h2 {
  font-size: 36px;
}
.family-self-spelling #spell-feedback {
  min-height: 40px;
  font-size: 24px;
}
.family-self-spelling label {
  display: block;
  font-size: 20px;
  margin-top: 20px;
}
@keyframes brick-in {
  from {
    transform: translateY(-45px) rotate(-12deg);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-reward .family-brick {
    animation: none;
  }
}
@media (max-width: 600px) {
  .family-shell {
    padding: 20px 16px 40px;
  }
  .family-header {
    gap: 12px;
    margin-bottom: 20px;
  }
  .family-avatar {
    width: 64px;
    height: 64px;
  }
  .family-header .family-stats-link {
    font-size: 15px;
    padding: 4px;
  }
  .family-hero {
    padding: 22px;
    min-height: 185px;
  }
  .family-hero h2 {
    font-size: 40px;
  }
  .family-hero .family-mark {
    font-size: 70px;
    min-width: 70px;
  }
  .family-hero p {
    font-size: 19px;
  }
  .family-grid {
    gap: 12px;
  }
  .family-tile {
    padding: 18px 14px;
    min-height: 120px;
    display: grid;
  }
  .family-tile strong {
    font-size: 26px;
  }
  .family-tile .symbol {
    font-size: 32px;
  }
  .family-panel {
    padding: 18px;
  }
  .family-parent .form-grid {
    grid-template-columns: 1fr;
  }
  .family-reward {
    gap: 10px;
    flex-wrap: wrap;
    min-width: 280px;
    font-size: 18px;
  }
  .family-reward .family-brick {
    width: 52px;
    height: 35px;
  }
  .family-task {
    padding: 14px;
    flex-wrap: wrap;
  }
  .family-person {
    gap: 10px;
  }
  .family-footer {
    align-items: flex-start;
  }
  .family-detail {
    font-size: 15px;
  }
}
.family-child #parent-area,
.family-child #btn-parent,
.family-child #screen-home .home-sub,
.family-child #child-home,
.family-child .reset-link {
  display: none !important;
}
.family-child.spelling-child > header,
.family-child.spelling-child > footer,
.family-child.spelling-child > div,
.family-child.spelling-child > main:not(.family-self-spelling) {
  display: none !important;
}
.family-child .home h1 {
  font-size: 40px;
  margin: 16px 0 28px;
}
.family-child .unit-section {
  border: var(--family-line);
  border-radius: 3px;
  background: #fffaf2;
  box-shadow: none;
}
.family-child .unit-title {
  font-size: 24px;
  font-weight: 900;
}
.family-child .sub-btn {
  font-size: 22px;
  border-radius: 3px;
}
.family-child .st-btn {
  font-size: 20px;
}
.family-child .subject-toggle:has(button:only-child),
.family-child .semester-toggle:empty {
  display: none;
}
.family-child .home-title {
  font-size: 46px;
}
.family-child .btn-start {
  border-radius: 3px;
  background: #bdcedf;
  color: #24374c;
  border: var(--family-line);
}
.family-child #screen-home {
  padding-top: 40px;
}
.family-child .family-reward {
  display: flex !important;
}
.family-child .family-notice {
  display: block !important;
}
.family-child .family-appbar {
  width: min(100%, 1040px);
  box-sizing: border-box;
}
.family-appbar img {
  display: inline-block;
}
.family-child .family-self-spelling {
  width: min(720px, calc(100% - 32px));
  box-sizing: border-box;
  font-family:
    system-ui,
    -apple-system,
    "Microsoft JhengHei",
    sans-serif;
}
.family-self-spelling button[aria-pressed="true"] {
  background: #263d55;
  color: white;
}
.family-self-spelling input {
  box-sizing: border-box;
}
.spelling-child .fa:before,
.spelling-child .fas:before {
  content: none !important;
}
.family-child .header .title,
.family-child .header .subtitle {
  color: var(--family-ink);
  text-shadow: none;
}
.family-child .header .subtitle {
  display: none;
}
.family-child .card {
  border: var(--family-line);
  border-radius: 3px;
  box-shadow: none;
}
.family-child .family-appbar a {
  display: inline-flex;
  align-items: center;
}
.family-child .btn--primary {
  background: #263d55;
}

.family-connect {
  max-width: 560px;
  margin: 40px auto;
}
.family-connect h1 {
  font-size: 32px;
}
.family-connect p {
  margin: 18px 0;
}
.family-connect form {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}
.family-connect input {
  width: 100%;
  box-sizing: border-box;
}
.family-connection-notice {
  padding: 14px;
  border: 2px solid #967225;
  background: #fff3ce;
  margin-bottom: 18px;
}
.family-connection-notice button {
  margin-left: 12px;
}

/* 一個活動一張卡，選填任務直接收在卡內。 */
.activity-grid {
  align-items: start;
}
.family-activity {
  border: var(--family-line);
  background: var(--family-blue);
  min-width: 0;
}
.family-activity:nth-child(4n + 2) {
  background: var(--family-yellow);
}
.family-activity:nth-child(4n + 3) {
  background: var(--family-green);
}
.family-activity:nth-child(4n) {
  background: var(--family-red);
}
.activity-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  min-height: 154px;
  text-decoration: none;
}
.activity-heading h2 {
  font-size: clamp(28px, 4vw, 40px);
  overflow-wrap: anywhere;
}
.activity-heading .symbol {
  flex-shrink: 0;
  font-size: 48px;
}
.family-page button.activity-history {
  display: block;
  margin: 0 26px 20px;
  min-height: 48px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 18px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.family-articles {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}
.family-article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 24px;
  border: var(--family-line);
  background: #fffaf2;
  text-decoration: none;
}
.family-article strong {
  font-size: 26px;
  overflow-wrap: anywhere;
}
.family-article time {
  font-size: 18px;
}
.activity-tasks {
  padding: 0 18px;
  display: grid;
  gap: 10px;
}
.activity-task {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 16px;
  padding: 16px;
  background: #fffaf2;
  border: var(--family-line);
  font-size: 18px;
  text-decoration: none;
}
.activity-task.completed {
  background: #f1f4e7;
}
.activity-task span {
  white-space: nowrap;
}
.activity-free {
  display: block;
  padding: 18px 26px;
  min-height: 52px;
  font-size: 18px;
  text-underline-offset: 5px;
}
.website-editor {
  min-width: 0;
  border: var(--family-line);
  padding: 16px;
  display: grid;
  gap: 14px;
}
.website-editor legend {
  overflow-wrap: anywhere;
  max-width: 100%;
}
.family-sync-list {
  margin: 0;
}
.family-sync-list > div {
  padding: 12px 0;
  border-bottom: 1px solid #cecac3;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 3fr);
  gap: 8px 20px;
}
.family-sync-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 600;
}
@media (max-width: 600px) {
  .family-sync-list > div {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .activity-heading {
    padding: 20px;
    min-height: 130px;
  }
  .activity-heading .symbol {
    font-size: 38px;
  }
}
