.family-wrap.notebook-wrap { width: min(calc(100% - 2rem), 83rem); padding-top: 1.35rem; }
.notebook-heading { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .8rem; margin-bottom: 1.15rem; }
.notebook-heading h1 { grid-column: 2; text-align: center; font-size: clamp(2rem, 5vw, 3.55rem); }
.notebook-heading h1 span { color: #ffcf7c; }
.notebook-heading .button { justify-self: start; border-color: #d6a65a; border-radius: 4rem; }
.notebook-shell { display: grid; grid-template-columns: minmax(0, 14.5rem) minmax(0, 1fr); gap: .85rem; align-items: start; }
.notebook-sidebar, .notebook-paper {
  min-width: 0; border: 1px solid #ffd281; border-radius: 1.25rem; padding: clamp(.75rem, 2.2vw, 1.55rem);
  box-shadow: inset 0 0 0 2px #75431e, inset 0 0 0 4px #ffd58988, 0 6px 20px #0005;
}
.notebook-sidebar { background: linear-gradient(#08291bed,#0d2d20f5), url("/media/family-entry-scene.webp") left center / cover; }
.notebook-sidebar h2 { color: #ffdd9c; font-size: 2rem; margin-bottom: .65rem; }
.notebook-sidebar nav { display: grid; gap: .5rem; margin-bottom: .65rem; max-height: 29rem; overflow-y: auto; padding: .2rem; }
.notebook-sidebar nav a { display: flex; align-items: center; gap: .6rem; border: 1px solid #b8864f; background: #1d4230; border-radius: .8rem; padding: .55rem; text-decoration: none; }
.notebook-sidebar nav a[aria-current] { background: linear-gradient(#305844,#1b382b); border-color: #af9a7c; }
.notebook-sidebar nav a strong { overflow-wrap: anywhere; }
.notebook-sidebar nav a span { min-width: 0; }
.notebook-sidebar nav small { display: block; }
.notebook-sidebar .family-avatar-image { width: 2.75rem; height: 2.75rem; flex: none; border: 1px solid #e5b769; }
.notebook-sidebar > .button { width: 100%; border-color: #d6a65a; }
.notebook-paper {
  color: #381c12; background: linear-gradient(#fff2d59c,#ffe9c597), url("/media/family-decor-paper.webp") center / cover, #f6d49c;
}
.notebook-editor-head, .notebook-profile-hero { display: flex; align-items: center; gap: clamp(.7rem, 3vw, 1.8rem); }
.notebook-editor-head > .family-avatar-image, .notebook-profile-hero > .family-avatar-image {
  width: clamp(4.75rem, 13vw, 10rem); height: auto; flex: none; border: 2px solid #ffe9ac; outline: 1px solid #a35d28; box-shadow: 0 3px 10px #8c481456;
}
.notebook-basic { display: grid; grid-template-columns: 1.4fr .65fr 1fr; gap: .55rem; flex: 1; min-width: 0; }
.notebook-editor label { font-weight: 700; }
.notebook-basic input, .notebook-basic select, .notebook-fields textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: .3rem; padding: .6rem;
  font: inherit; color: #381c12; background: #fff7e6; border: 1px solid #a7673e; border-radius: .55rem;
}
.notebook-fields textarea { resize: vertical; }
.notebook-editor .family-avatar-picker { margin-block: 1rem; }
.notebook-editor .family-avatar-picker label:has(:checked) { border-color: #305844; }
.notebook-tabs { display: flex; gap: .23rem; overflow-x: auto; padding: .22rem .18rem; }
.notebook-tabs button {
  flex: 1 0 auto; min-height: 44px; max-width: 10.5rem; border: 1px solid #b77949; border-radius: .65rem; padding: .45rem .65rem;
  color: #3f2d24; background: linear-gradient(#fff8f0,#e9d9c9); font: 700 1rem/1.1 var(--serif); cursor: pointer;
}
.notebook-tabs button span { display: block; font-size: 1.23rem; }
.notebook-tabs button[aria-selected=true] { color: #fff8f0; background: linear-gradient(#305844,#1b382b); border-color: #af9a7c; }
.notebook-fields { margin-top: .45rem; padding: .85rem; border: 1px solid #c28b56; border-radius: .85rem; background: #fff4db91; }
.notebook-fields > label { display: block; margin-bottom: .45rem; }
.notebook-interests { display: flex; min-width: 0; flex-wrap: wrap; gap: .35rem; padding: 0; border: 0; margin: 0 0 .6rem; }
.notebook-interests legend { font-weight: 700; margin-bottom: .5rem; }
.notebook-interests label { display: inline-flex; align-items: center; min-height: 40px; gap: .35rem; padding: .3rem .48rem; border: 1px solid #d5a36b; border-radius: .55rem; background: #fff1d2; }
.notebook-interests input { accent-color: #8a1422; }
.notebook-privacy, .notebook-empty { font-size: .875rem; margin: .85rem 0; }
.notebook-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: .65rem; }
.notebook-paper .secondary { color: #711b25; border-color: #ad6a38; }
.notebook-profile-hero {
  border-radius: 1rem; padding: 1rem; border: 1px solid #c18542;
  background: linear-gradient(90deg,#fff3db72,#fff2db65), url("/media/family-decor-profile.webp") center / cover;
}
.notebook-profile-hero div { flex: 1; min-width: 0; }
.notebook-profile-hero h2 { color: #761422; overflow-wrap: anywhere; font-size: clamp(1.8rem, 5vw, 3.5rem); }
.notebook-profile-hero p { margin: .35rem 0; }
.notebook-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .55rem; margin-top: .6rem; }
.notebook-summary-card {
  border: 1px solid #bf8a56; border-radius: .85rem; padding: .8rem; background: linear-gradient(#fff6e4,#f9dfb0);
  box-shadow: inset 0 0 0 2px #fff2cf, 0 .2rem .4rem #72441e22; overflow-wrap: anywhere;
}
.notebook-summary-card h3 { color: #771623; }
.notebook-summary-card p { white-space: pre-wrap; margin: .5rem 0 0; }
.notebook-notice { color: #184631; margin: 0 0 .75rem; font-weight: 700; }
.notebook-paper [role=status]:empty { display: none; }
#account .family-guest .family-profile { flex-wrap: wrap; }
@media (max-width: 850px) {
  .notebook-shell { grid-template-columns: minmax(0,1fr); }
  .notebook-sidebar nav { display: flex; overflow-x: auto; }
  .notebook-sidebar nav a { flex: 0 0 auto; max-width: min(15rem, 85%); }
  .notebook-sidebar > .button { width: auto; }
  .notebook-heading { display: flex; flex-wrap: wrap; justify-content: center; }
  .notebook-heading h1 { flex-basis: 100%; }
}
@media (max-width: 570px) {
  .family-wrap.notebook-wrap { width: calc(100% - 1rem); }
  .notebook-editor-head { align-items: start; }
  .notebook-basic, .notebook-summary { grid-template-columns: minmax(0,1fr); }
  .notebook-basic input, .notebook-basic select, .notebook-fields textarea { font-size: 1rem; }
  .notebook-profile-hero { flex-wrap: wrap; }
  .notebook-actions > .story-call { flex: 1; }
}

.family-cabinet:has(.notebook-wrap) {
  position: relative;
  isolation: isolate;
  background: #09271d;
}
.family-cabinet:has(.notebook-wrap)::before,
.family-cabinet:has(.notebook-wrap)::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  pointer-events: none;
  z-index: -1;
  background-image: url("/media/notebook-frame-wide.webp");
  background-repeat: no-repeat;
  background-size: 100% auto;
}
.family-cabinet:has(.notebook-wrap)::before {
  inset-block-start: 0;
  height: clamp(10rem, 25vw, 28rem);
  background-position: center top;
  mask-image: linear-gradient(#000 52%, transparent);
}
.family-cabinet:has(.notebook-wrap)::after {
  inset-block-end: 0;
  height: clamp(9rem, 23vw, 25rem);
  background-position: center bottom;
  mask-image: linear-gradient(transparent, #000 29%);
}
.family-wrap.notebook-wrap {
  width: min(83rem, 86%);
  padding-top: clamp(1.75rem, 4vw, 3.15rem);
  padding-bottom: clamp(9rem, 20vw, 18rem);
}
.notebook-heading { margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.notebook-heading h1 {
  color: #fff0d0;
  text-shadow: 0 2px 16px #000a;
  font-weight: 650;
  line-height: 1;
}
.notebook-heading h1 span { display: block; font-size: .52em; line-height: 1.3; text-shadow: 0 0 13px #ef9b40; }
.notebook-heading h1::after {
  content: "";
  display: block;
  height: 1px;
  width: min(78%, 13rem);
  margin: .65rem auto 0;
  background: linear-gradient(90deg, transparent, #fbd584, transparent);
}
.notebook-heading .button { background: #09271ee8; }
.notebook-reading { grid-template-columns: minmax(0, 1fr); }
.notebook-reading .notebook-sidebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}
.notebook-reading .notebook-sidebar h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.notebook-reading .notebook-sidebar nav { display: flex; max-width: 100%; overflow-x: auto; margin: 0; }
.notebook-reading .notebook-sidebar nav a { flex: 0 0 auto; min-width: 8rem; max-width: min(15rem,75vw); border-radius: 2rem; }
.notebook-reading .notebook-sidebar > .button { width: auto; border-radius: 2rem; background: #113a29; }
.notebook-sidebar nav a[aria-current] { box-shadow: inset 0 0 .5rem #ffb16477; }
.notebook-reading .notebook-paper {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.notebook-reading .notebook-paper :is(.notebook-empty,.notebook-notice) { color: #ffedc7; }
.notebook-reading .notebook-actions .button { color: #ffdfaa; background: #123523; }
.notebook-profile-hero {
  min-height: clamp(10rem, 20vw, 16rem);
  padding: clamp(1rem, 3vw, 2.1rem);
  border-color: #ffdc91;
  background: linear-gradient(90deg,#fff2d1a6 28%,#fff2d1ca 58%,transparent),
    url("/media/family-decor-profile.webp") right center / cover, #f8d9a4;
  box-shadow: inset 0 0 0 2px #8b4a20, inset 0 0 0 4px #fff0c7, 0 .35rem 1.25rem #0007;
}
.notebook-profile-hero > .family-avatar-image { width: clamp(5rem, 17vw, 12rem); }
.notebook-profile-hero .story-call { align-self: center; }
.notebook-summary { gap: .75rem; margin-top: .78rem; }
.notebook-summary-card {
  min-height: 8rem;
  border-color: #f9d494;
  box-shadow: inset 0 0 0 2px #b57446, inset 0 0 0 4px #fff1cd, 0 .25rem .65rem #0005;
}
.notebook-fields-interests { --notebook-illustration: url("/media/notebook-card-interests.webp"); }
.notebook-fields-dreams { --notebook-illustration: url("/media/notebook-card-dreams.webp"); }
.notebook-fields-characters { --notebook-illustration: url("/media/notebook-card-characters.webp"); }
.notebook-fields-pets { --notebook-illustration: url("/media/notebook-card-pets.webp"); }
.notebook-fields-moments { --notebook-illustration: url("/media/notebook-card-moments.webp"); }
.notebook-fields-secrets { --notebook-illustration: url("/media/notebook-card-secrets.webp"); }
.notebook-summary-card:not(.notebook-fields-about) {
  padding-inline-end: 32%;
  background: linear-gradient(90deg,#fff0d5 36%,#fff0d5a6 60%,transparent 81%),
    var(--notebook-illustration) right bottom / auto 110% no-repeat, #fff0d5;
}
.notebook-fields:not(.notebook-fields-about) {
  padding-inline-end: 24%;
  background: linear-gradient(90deg,#fff2d7 60%,#fff2d788 78%,transparent),
    var(--notebook-illustration) right bottom / auto 100% no-repeat, #fff2d7;
}
.notebook-tabs { scroll-padding-inline: .15rem; overscroll-behavior-inline: contain; }

@media (max-width: 850px) {
  .family-cabinet:has(.notebook-wrap)::before,
  .family-cabinet:has(.notebook-wrap)::after {
    background-image: url("/media/notebook-frame-mobile.webp");
  }
  .family-cabinet:has(.notebook-wrap)::before { height: 8rem; }
  .family-cabinet:has(.notebook-wrap)::after { height: clamp(9rem, 52vw, 20rem); }
  .family-wrap.notebook-wrap { width: calc(100% - 1rem); padding: 1.1rem 0 clamp(9.5rem, 53vw, 20rem); }
  .notebook-heading { position: relative; flex-direction: column; align-items: flex-start; margin-bottom: .8rem; }
  .notebook-heading h1 { width: 100%; margin-top: .3rem; }
  .notebook-sidebar { padding: .65rem; }
  .notebook-sidebar h2 { font-size: 1.45rem; margin-bottom: .28rem; }
  .notebook-sidebar nav a { padding: .3rem .55rem; min-height: 44px; }
  .notebook-sidebar .family-avatar-image { width: 2rem; height: 2rem; }
  .notebook-reading .notebook-sidebar { justify-content: flex-start; }
  .notebook-reading .notebook-sidebar nav { width: 100%; }
  .notebook-profile-hero .story-call { min-height: 44px; }
}
@media (max-width: 570px) {
  .notebook-editor-head > .family-avatar-image { width: 3.2rem; }
  .notebook-basic { gap: .45rem; }
  .notebook-editor .family-avatar-picker { margin-block: .65rem; }
  .notebook-editor .family-avatar-picker > div { gap: .25rem; }
  .notebook-editor .family-avatar-picker label { width: 2.65rem; height: 2.65rem; }
  .notebook-summary-card:not(.notebook-fields-about) { padding-inline-end: 29%; }
  .notebook-fields:not(.notebook-fields-about) { padding-inline-end: .8rem; background-size: 100% 100%, auto 55%; }
  .notebook-fields textarea { background: #fff7e9ed; }
  .notebook-tabs button { min-width: 6.15rem; max-width: 9rem; white-space: normal; }
}

.notebook-reading .notebook-actions { justify-content: center; }
@media (max-width: 570px) {
  .notebook-profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: .85rem;
    row-gap: .8rem;
  }
  .notebook-profile-hero .story-call { grid-column: 1 / -1; justify-self: start; }
  .notebook-profile-hero h2 { overflow-wrap: break-word; }
}

.notebook-editor .notebook-avatar-group + .notebook-avatar-group { margin-top: .55rem; }
.notebook-editor .notebook-avatar-group p {
  flex-basis: 100%;
  margin: 0;
  color: #684b35;
  font-weight: 650;
  font-size: .85rem;
}
@media (max-width: 760px) {
  .notebook-editor .notebook-avatar-group label { width: 2.75rem; height: 2.75rem; }
}


.notebook-editor .family-avatar-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
.notebook-editor .family-avatar-picker .notebook-avatar-group {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin: 0;
}
.notebook-editor .notebook-avatar-group p { grid-column: 1 / -1; }
.notebook-editor .family-avatar-picker .notebook-avatar-group label {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  max-width: 3.1rem;
}
.notebook-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow-x: visible;
}
.notebook-tabs button { min-width: 0; max-width: none; overflow-wrap: anywhere; padding-inline: .25rem; }
@media (min-width: 851px) {
  .family-wrap.notebook-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100svh - 75px);
    padding-block: .8rem;
    width: min(83rem, calc(100% - 2rem));
  }
  .notebook-heading { flex: none; margin-bottom: .65rem; }
  .notebook-heading h1 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); }
  .notebook-shell { min-height: 0; overflow: auto; scrollbar-gutter: stable; }
  .notebook-paper { padding: .8rem; }
  .notebook-editor-head > .family-avatar-image { width: 4rem; }
  .notebook-editor .family-avatar-picker { margin-block: .55rem; }
  .notebook-fields { padding: .55rem; }
  .notebook-privacy { margin: .5rem 0; }
  .notebook-profile-hero { min-height: 0; padding: .9rem; }
  .notebook-profile-hero > .family-avatar-image { width: clamp(4rem, 9vw, 7rem); }
  .notebook-summary-card { min-height: 0; }
}
@media (max-width: 850px) {
  .notebook-editor .family-avatar-picker { grid-template-columns: minmax(0, 1fr); }
  .notebook-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .notebook-heading h1 { grid-column: auto; }
}
@media (max-width: 420px) {
  .notebook-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .notebook-editor .family-avatar-picker .notebook-avatar-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
