:root {
  color-scheme: light;
  --bg: #f7f8f4;
  --surface: #fff;
  --subtle: #f0f3ed;
  --primary: #3f6b56;
  --primary-hover: #345a48;
  --primary-soft: #e7eee5;
  --on-primary: #fff;
  --text: #27352d;
  --secondary: #55665b;
  --muted: #637267;
  --border: #dde5da;
  --control-border: #7c8e80;
  --focus: #2f7350;
  --chart-shell: #416f98;
  --chart-weight: #3f6b56;
  --warning: #8a5708;
  --warning-soft: #fff4db;
  --danger: #a13c37;
  --danger-soft: #fae9e7;
  --profile-bg: #f4efe0;
  --profile-text: #756030;
  --spotlight-placeholder: #dce4d5;
  --photo-placeholder: #e3e8dc;
  --shadow: 0 8px 24px rgba(39, 53, 45, .1);
  --scrim: rgba(23, 35, 27, .42);
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151d19;
  --surface: #1d2822;
  --subtle: #243229;
  --primary: #9ecbae;
  --primary-hover: #b3dcc1;
  --primary-soft: #293d31;
  --on-primary: #14261b;
  --text: #e8efea;
  --secondary: #b8c8bd;
  --muted: #a4b8aa;
  --border: #35483c;
  --control-border: #718a79;
  --focus: #b5e0c1;
  --chart-shell: #91badd;
  --chart-weight: #9ecbae;
  --warning: #e9c07a;
  --warning-soft: #3d3218;
  --danger: #f0aaa5;
  --danger-soft: #442c2a;
  --profile-bg: #393627;
  --profile-text: #dfcca0;
  --spotlight-placeholder: #243229;
  --photo-placeholder: #243229;
  --shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --scrim: rgba(5, 12, 8, .68);
}

* { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.625 var(--font-sans); -webkit-font-smoothing: antialiased; }
body.dialog-open { overflow: hidden; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button { border: 0; padding: 0; background: none; }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; }
button, a, input { transition: background-color 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; }
[hidden] { display: none !important; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.container { width: min(100% - 2rem, 75rem); margin-inline: auto; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); background: var(--text); color: var(--surface); }
.skip-link:focus { width: auto; height: auto; padding: 12px 20px; clip-path: none; }
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: 1.125rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.brand-mark .icon { width: 26px; height: 28px; }
.brand-caption { display: none; font-size: .8125rem; font-weight: 400; color: var(--muted); letter-spacing: .02em; margin-top: 3px; }
.desktop-nav { display: none; align-self: stretch; align-items: stretch; gap: 28px; }
.nav-link { position: relative; display: flex; align-items: center; font-size: .875rem; color: var(--secondary); }
.nav-link.is-current { color: var(--primary); font-weight: 600; }
.nav-link.is-current::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--primary); }
.nav-link:hover { color: var(--primary); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 8px; }
.icon-button:hover { background: var(--primary-soft); }
.search-trigger { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; border-radius: 8px; color: var(--secondary); }
.search-trigger:hover { background: var(--primary-soft); }
.search-trigger span, .search-trigger kbd { display: none; }
.intro { display: flex; flex-direction: column; gap: 20px; padding-block: 32px 28px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--primary); margin-bottom: 10px; }
.eyebrow .icon { width: 16px; height: 16px; }
h1 { font-size: 1.75rem; line-height: 1.36; }
h1 span { color: var(--primary); }
.intro-description { margin-top: 12px; color: var(--secondary); font-size: 1rem; line-height: 1.75; max-width: 32rem; }
.intro-aside { display: flex; align-items: center; }
.intro-aside p { display: none; }
.spotlight { display: grid; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.spotlight-photo { position: relative; min-width: 0; background: var(--spotlight-placeholder); aspect-ratio: 3 / 2; }
.spotlight-photo > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 54%; }
.photo-caption { position: absolute; inset: auto 12px 12px; display: flex; gap: 6px; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 5px; color: #fff; background: #27352d; font-size: .8125rem; }
.photo-caption .icon { width: 14px; height: 14px; }
.photo-caption span { border-left: 1px solid #aebbb1; padding-left: 7px; margin-left: 3px; }
.spotlight-copy { display: flex; flex-direction: column; padding: 24px 20px; }
.spotlight-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .8125rem; }
.spotlight-meta > span { display: flex; gap: 6px; align-items: center; color: var(--primary); }
.spotlight-meta .icon { width: 16px; height: 16px; }
.spotlight h2 { font-size: 1.5rem; line-height: 1.55; margin-top: 20px; }
.spotlight-description { margin-top: 14px; color: var(--secondary); font-size: 1rem; line-height: 1.85; max-width: 25rem; }
.spotlight-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; color: var(--muted); font-size: .8125rem; }
.spotlight-tags span { border: 1px solid var(--border); border-radius: 5px; padding: 3px 7px; }
.spotlight-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.small-profile { display: flex; align-items: center; gap: 10px; }
.profile-initial { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--profile-bg); color: var(--profile-text); font-size: .875rem; }
.small-profile strong, .small-profile div > span { display: block; }
.small-profile strong { font-size: .875rem; font-weight: 500; }
.small-profile div > span { font-size: .8125rem; color: var(--muted); margin-top: 1px; }
.text-link { display: inline-flex; gap: 8px; align-items: center; min-height: 48px; font-size: .875rem; color: var(--primary); white-space: nowrap; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-link .icon { width: 17px; height: 17px; }
.residents-section { margin-top: 36px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-overline { font-size: .8125rem; color: var(--muted); margin-bottom: 5px; }
.section-heading h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 1.375rem; line-height: 1.45; }
.count-badge { font-size: .8125rem; font-weight: 500; color: var(--primary); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; align-self: center; }
.section-description { display: none; font-size: .875rem; color: var(--muted); }
.filter-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 12px; border-radius: 7px; font-size: 1rem; color: var(--secondary); }
.filter-button:hover { background: var(--subtle); }
.filter-button.is-selected { color: var(--on-primary); background: var(--primary); }
.filter-button.is-selected:hover { background: var(--primary-hover); }
.filter-button span { font-size: .8125rem; }
.filter-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.residents-grid { display: grid; gap: 32px; }
.resident-card { min-width: 0; }
.resident-photo { position: relative; display: block; width: 100%; overflow: hidden; border-radius: 12px; background: var(--photo-placeholder); aspect-ratio: 4 / 3; }
.resident-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-index { position: absolute; top: 12px; left: 12px; padding: 3px 8px; border-radius: 4px; font-size: .8125rem; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
.photo-action { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--text); background: var(--bg); transition: background-color 140ms ease-out, color 140ms ease-out; }
.resident-photo:hover .photo-action, .resident-photo:focus-visible .photo-action { background: var(--primary); color: var(--on-primary); }
.photo-action .icon { width: 17px; height: 17px; }
.resident-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; }
.resident-title h3 { font-size: 1.125rem; line-height: 1.56; }
.resident-title h3 button { min-height: 44px; font-weight: 600; }
.resident-title h3 button:hover { color: var(--primary); }
.species-tag { font-size: .8125rem; color: var(--muted); }
.resident-description { font-size: .875rem; line-height: 1.7; color: var(--secondary); margin-bottom: 16px; }
.resident-measures { display: flex; align-items: center; gap: 22px; padding-top: 13px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.resident-measures > span { display: flex; align-items: baseline; gap: 7px; }
.measure-label { color: var(--muted); font-size: .8125rem; }
.resident-measures strong { font-size: 1rem; font-weight: 500; }
.resident-measures small { font-weight: 400; font-size: .8125rem; color: var(--muted); }
.resident-measures time { font-size: .8125rem; margin-left: auto; color: var(--muted); }
.journal-wiki-layout { display: grid; gap: 36px; margin-top: 40px; }
.section-icon { color: var(--primary); width: 24px; height: 24px; }
.journal-list { margin-top: 20px; }
.journal-entry { display: flex; width: 100%; align-items: center; text-align: left; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.journal-entry:first-child { padding-top: 0; }
.journal-entry:last-child { border-bottom: none; }
.journal-date { display: grid; align-content: center; justify-items: center; min-width: 32px; font-variant-numeric: tabular-nums; }
.journal-date strong { font-size: 1.25rem; line-height: 1.5; font-weight: 500; }
.journal-date > span { font-size: .8125rem; color: var(--muted); }
.journal-entry-content { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.entry-kind { display: flex; align-items: center; gap: 5px; font-size: .8125rem; color: var(--muted); }
.entry-kind .icon { width: 13px; height: 13px; }
.journal-entry-content strong { font-size: 1rem; font-weight: 500; line-height: 1.6; }
.journal-entry-content > span:last-child { color: var(--muted); font-size: .8125rem; }
.journal-entry img { width: 60px; height: 60px; object-fit: cover; flex-shrink: 0; border-radius: 8px; }
.journal-entry:hover strong { color: var(--primary); }
.wiki-section { border-top: 1px solid var(--border); padding-top: 32px; min-width: 0; }
.wiki-introduction { font-size: .875rem; color: var(--muted); margin-top: 14px; }
.wiki-list { margin-top: 10px; }
.wiki-entry { display: flex; width: 100%; text-align: left; gap: 14px; align-items: flex-start; padding: 17px 0; border-bottom: 1px solid var(--border); }
.wiki-entry:last-child { border-bottom: none; }
.wiki-index { font-size: .8125rem; color: var(--muted); line-height: 1.8; font-variant-numeric: tabular-nums; }
.wiki-entry-content { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.wiki-category { font-size: .8125rem; color: var(--primary); }
.wiki-entry strong { font-weight: 500; font-size: 1rem; line-height: 1.65; }
.wiki-entry-content > span:last-child { font-size: .8125rem; color: var(--muted); }
.wiki-entry > .icon { width: 17px; height: 17px; margin-top: 18px; color: var(--muted); }
.wiki-entry:hover strong { color: var(--primary); }
.wiki-footnote { display: flex; align-items: flex-start; gap: 6px; margin-top: 14px; font-size: .8125rem; color: var(--muted); }
.wiki-footnote .icon { width: 15px; height: 15px; margin-top: 2px; }
.about-section { display: flex; flex-wrap: wrap; gap: 14px; padding: 24px 20px; margin-top: 36px; background: var(--primary-soft); border-radius: 12px; align-items: center; }
.about-mark { display: grid; place-items: center; color: var(--primary); width: 40px; flex-shrink: 0; }
.about-mark .icon { width: 32px; height: 36px; }
.about-section > div:nth-child(2) { flex: 1; min-width: 0; }
.about-section h2 { font-size: 1rem; font-weight: 500; line-height: 1.7; }
.about-section p { font-size: .8125rem; line-height: 1.8; margin-top: 5px; color: var(--secondary); }
.private-note { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: .8125rem; width: 100%; padding-left: 54px; }
.private-note .icon { width: 14px; height: 14px; }
.site-footer { padding-block: 28px calc(24px + env(safe-area-inset-bottom)); }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.footer-brand { font-size: .875rem; font-weight: 600; }
.footer-brand span { font-size: .8125rem; font-weight: 400; color: var(--muted); display: block; margin-top: 5px; }
.footer-top > a:last-child { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: .8125rem; color: var(--secondary); }
.footer-top > a:last-child .icon { width: 15px; height: 15px; }
.notice { padding: 12px; background: var(--primary-soft); color: var(--primary); margin-top: 20px; font-size: .875rem; }

dialog { padding: 20px; border: 1px solid var(--border); border-radius: 16px; width: min(40rem, calc(100% - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); background: var(--surface); color: var(--text); box-shadow: var(--shadow); overscroll-behavior: contain; }
dialog::backdrop { background: var(--scrim); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dialog-heading h2 { font-size: 1.125rem; }
.search-field { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 48px; border: 1px solid var(--control-border); border-radius: 8px; }
.search-field .icon { color: var(--muted); }
.search-field input { border: 0; width: 100%; min-width: 0; padding-block: 11px; background: transparent; color: var(--text); font-size: 1rem; outline: none; }
.search-field:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.search-field input::placeholder { color: var(--muted); }
.search-summary { font-size: .8125rem; color: var(--muted); margin-block: 18px 8px; }
.search-results { min-height: 100px; }
.search-result { display: flex; flex-direction: column; width: 100%; text-align: left; border-radius: 8px; padding: 12px; gap: 4px; }
.search-result:hover { background: var(--primary-soft); }
.search-result strong { font-size: 1rem; font-weight: 500; }
.search-result span { font-size: .8125rem; color: var(--muted); }
.search-result:hover span { color: var(--secondary); }
.search-empty { padding: 24px 0; text-align: center; color: var(--secondary); }
.detail-image { width: 100%; max-height: 310px; object-fit: cover; border-radius: 10px; margin-bottom: 24px; }
.detail-category { color: var(--primary); font-size: .8125rem; margin-bottom: 8px; }
#detail-title { font-size: 1.5rem; line-height: 1.5; margin-bottom: 12px; overflow-wrap: anywhere; }
.detail-copy { font-size: 1rem; line-height: 1.85; color: var(--secondary); margin-top: 12px; }
.detail-measures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0; }
.detail-measures > div { background: var(--subtle); padding: 16px; border-radius: 8px; }
.detail-measures dt { font-size: .8125rem; color: var(--muted); }
.detail-measures dd { margin: 4px 0 0; font-weight: 500; font-size: 1.375rem; }
.detail-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8125rem; }
.menu-dialog { margin: 0 0 0 auto; height: 100vh; height: 100dvh; max-height: none; width: min(320px, calc(100% - 32px)); border-radius: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
.menu-dialog nav { display: flex; flex-direction: column; gap: 8px; }
.menu-dialog nav a { min-height: 48px; display: flex; align-items: center; padding: 8px 12px; border-radius: 8px; }
.menu-dialog nav a:hover { background: var(--primary-soft); }
.menu-note { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; line-height: 1.85; }

.theme-dialog { width: min(28rem, calc(100% - 32px)); }
.theme-options { display: grid; gap: 10px; margin-block: 16px; }
.theme-option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; min-height: 56px; padding: 12px 16px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--text); text-align: left; }
.theme-option:hover { background: var(--subtle); }
.theme-option strong { font-size: 1rem; font-weight: 600; }
.theme-option span { font-size: .8125rem; color: var(--secondary); }
.theme-option.is-selected { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.theme-option.is-selected:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.theme-option.is-selected span { color: inherit; }
#theme-status { color: var(--secondary); font-size: .875rem; line-height: 1.7; }
#theme-status.is-storage-error { color: var(--danger); }

@media (min-width: 640px) {
  .container { width: min(100% - 3rem, 75rem); }
  .header-inner { min-height: 72px; }
  .brand { font-size: 1.25rem; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-caption { display: block; }
  .intro { padding-block: 40px 32px; }
  h1 { font-size: 2.5rem; line-height: 1.3; }
  .intro-description { max-width: none; }
  .spotlight-copy { padding: 32px; }
  .spotlight h2 { font-size: 1.75rem; line-height: 1.5; }
  .spotlight h2 br { display: none; }
  .spotlight-description { max-width: none; }
  .spotlight-photo { max-height: 400px; }
  .residents-section { margin-top: 48px; }
  .section-heading h2 { font-size: 1.5rem; line-height: 1.42; }
  .filter-button { min-height: 40px; font-size: .875rem; padding: 7px 14px; }
  .filter-status { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .residents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
  .journal-wiki-layout { margin-top: 48px; }
  .journal-entry { gap: 20px; }
  .journal-entry img { width: 72px; height: 72px; }
  .about-section { padding: 28px; gap: 20px; }
  .private-note { padding-left: 60px; }
  .footer-brand span { display: inline; margin-left: 14px; }
  dialog { padding: 24px; }
}

@media (min-width: 1024px) {
  .container { width: min(100% - 4rem, 75rem); }
  .header-inner { min-height: 80px; }
  .desktop-nav { display: flex; }
  .mobile-menu-button { display: none; }
  .search-trigger { justify-content: flex-start; width: auto; gap: 9px; padding-inline: 12px; background: var(--subtle); min-height: 36px; }
  .search-trigger span { display: inline; font-size: .8125rem; }
  .search-trigger kbd { display: inline-flex; justify-content: center; align-items: center; width: 20px; height: 22px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); font: .8125rem var(--font-sans); margin-left: 16px; }
  .search-trigger .icon { width: 17px; height: 17px; }
  .intro { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 32px; padding-block: 38px 30px; }
  .intro-aside { flex-direction: column; align-items: flex-end; gap: 14px; padding-bottom: 3px; }
  .intro-aside p { display: block; color: var(--muted); font-size: .8125rem; }
  .spotlight { grid-template-columns: 1.45fr 1fr; }
  .spotlight-photo { aspect-ratio: auto; max-height: none; min-height: 358px; }
  .spotlight-copy { padding: 26px 32px; }
  .spotlight h2 { margin-top: 22px; font-size: 1.75rem; line-height: 1.5; }
  .spotlight h2 br { display: inline; }
  .spotlight-description { font-size: .875rem; line-height: 1.9; margin-top: 12px; }
  .spotlight-tags { margin-top: 16px; }
  .spotlight-bottom { margin-top: auto; padding-top: 16px; }
  .spotlight-copy > .spotlight-tags { margin-bottom: 20px; }
  .photo-caption { bottom: 18px; left: 18px; }
  .section-description { display: block; align-self: flex-end; margin-bottom: 3px; }
  .residents-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .resident-measures { gap: 16px; }
  .journal-wiki-layout { grid-template-columns: 1.06fr 1fr; gap: 40px; margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--border); }
  .journal-list { margin-top: 26px; }
  .wiki-section { border-top: 0; padding-top: 0; padding-left: 40px; border-left: 1px solid var(--border); }
  .wiki-entry { gap: 16px; }
  .about-section { margin-top: 44px; padding: 26px 32px; }
  .about-section > div:nth-child(2) { flex: 1; }
  .private-note { width: auto; padding-left: 0; }
  .site-footer { padding-top: 30px; }
}

@media (min-width: 1280px) {
  .desktop-nav { gap: 36px; }
  .spotlight-copy { padding-inline: 38px; }
  .spotlight-photo { min-height: 362px; }
  .resident-measures { gap: 24px; }
  .journal-wiki-layout { gap: 48px; }
  .wiki-section { padding-left: 48px; }
}

@media (max-width: 359px) {
  .brand { font-size: 1rem; gap: 7px; }
  .brand-mark { width: 32px; height: 34px; }
  .header-inner { gap: 8px; }
  .header-actions { gap: 4px; }
  .journal-entry img { width: 44px; height: 44px; }
  .journal-entry { gap: 10px; }
  .resident-measures { gap: 12px; }
  .small-profile div > span { display: none; }
  .spotlight-bottom { gap: 8px; }
}

.header-actions { flex-shrink: 0; }
.brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-option { flex-direction: row; align-items: center; gap: 14px; }
.theme-option > span, .theme-option > span > span { display: block; }
.theme-option > span > span { margin-top: 3px; }
.growth-dialog { width: min(60rem, calc(100% - 32px)); }
.growth-dialog > .dialog-heading { position: sticky; top: -20px; background: var(--surface); z-index: 2; padding-block: 8px; }
.unused-dialog .detail-image { float: right; width: 88px; height: 76px; object-fit: cover; margin: 0 0 16px 12px; }
.growth-dialog .detail-copy { font-size: .875rem; }
.growth-workspace { clear: both; padding-top: 20px; }
.growth-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 24px; }
.growth-heading h3 { font-size: 1.25rem; line-height: 1.5; }
.range-field { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--secondary); }
select, textarea { font: inherit; }
.range-field select, .form-field input, .form-field textarea { border: 1px solid var(--control-border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 10px 12px; min-height: 44px; font-size: 1rem; }
.growth-method { color: var(--muted); font-size: .8125rem; line-height: 1.8; margin: 12px 0 16px; }
.growth-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.growth-chart { min-width: 0; padding: 16px 12px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.shell-chart { --chart-color: var(--chart-shell); }
.weight-chart { --chart-color: var(--chart-weight); }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chart-heading h4 { font-size: .9375rem; font-weight: 600; margin: 0; }
.chart-unit { padding: 1px 6px; background: var(--subtle); color: var(--secondary); border-radius: 4px; font-size: .8125rem; }
.chart-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 10px; }
.chart-summary strong { color: var(--chart-color); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-summary > span { color: var(--muted); font-size: .8125rem; }
.chart-canvas { width: 100%; height: 214px; margin-top: 8px; }
.chart-canvas svg { width: 100%; height: 214px; display: block; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 12px; font-family: var(--font-sans); }
.chart-series { stroke: var(--chart-color); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-point { fill: var(--surface); stroke: var(--chart-color); stroke-width: 2.5; }
.chart-caption { color: var(--muted); font-size: .8125rem; line-height: 1.7; padding-top: 4px; }
.measurement-editor { margin-top: 24px; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle); }
.measurement-editor summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; min-height: 52px; padding: 12px 16px; color: var(--primary); font-weight: 500; list-style: none; }
.measurement-editor summary::-webkit-details-marker { display: none; }
.editor-hint { color: var(--secondary); font-size: .8125rem; font-weight: 400; }
#measurement-form { padding: 0 16px 16px; }
.measurement-fields { display: grid; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--secondary); font-size: .875rem; }
.form-field input, .form-field textarea { width: 100%; min-width: 0; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--muted); }
.form-field textarea { resize: vertical; }
.field-help { color: var(--secondary); font-size: .8125rem; line-height: 1.8; }
#measurement-help { margin-top: 12px; }
.form-error { color: var(--danger); margin-top: 12px; font-size: .875rem; }
.form-error:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.primary-button { background: var(--primary); color: var(--on-primary); padding: 10px 18px; min-height: 48px; border-radius: 8px; font-weight: 500; }
.primary-button:hover { background: var(--primary-hover); }
.measurement-status { font-size: .875rem; color: var(--primary); margin-top: 12px; }
.measurement-status:empty { display: none; }
.history-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 24px 0 12px; }
.history-heading h3 { font-size: 1rem; }
.history-heading > span { color: var(--muted); font-size: .8125rem; }
.history-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.measurement-table { border-collapse: collapse; width: 100%; min-width: 620px; text-align: left; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.measurement-table th { font-weight: 500; color: var(--secondary); background: var(--subtle); white-space: nowrap; }
.measurement-table th, .measurement-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.measurement-table tr:last-child td { border-bottom: none; }
.measurement-table td:first-child { white-space: nowrap; }
.history-note { max-width: 260px; overflow-wrap: anywhere; }
.history-note p { margin-top: 5px; }
.record-source { color: var(--secondary); background: var(--subtle); padding: 2px 5px; border-radius: 4px; font-size: .8125rem; }
.remove-measurement { min-height: 44px; padding: 4px 8px; color: var(--danger); white-space: nowrap; border-radius: 6px; margin-top: -8px; }
.remove-measurement:hover { background: var(--danger-soft); }
.history-more { min-height: 44px; color: var(--primary); font-size: .875rem; margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 640px) {
  .growth-dialog > .dialog-heading { top: -24px; }
  .growth-dialog .detail-image { width: 144px; height: 96px; margin-left: 24px; }
  .measurement-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .note-field { grid-column: 1 / -1; }
}

@media (min-width: 800px) {
  .growth-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.catalog-toolbar .text-link { font-size: .8125rem; }
.card-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-avatar { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.card-identity h3 { min-width: 0; }
.card-identity button { overflow-wrap: anywhere; text-align: left; }
.status-badge { padding: 3px 8px; border-radius: 6px; font-size: .8125rem; white-space: nowrap; flex-shrink: 0; color: var(--secondary); background: var(--subtle); }
.status-healthy { color: var(--primary); background: var(--primary-soft); }
.status-sick { color: var(--danger); background: var(--danger-soft); }
.status-recovering { color: var(--chart-shell); background: var(--subtle); }
.status-deceased { border: 1px solid var(--control-border); }
.card-classification { margin: 4px 0 8px; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.resident-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resident-measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.card-metric { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card-metric strong { font-size: 1rem; overflow-wrap: anywhere; }
.card-metric .metric-date { color: var(--muted); font-size: .75rem; line-height: 1.6; overflow-wrap: anywhere; }
.metric-age strong { font-size: .9375rem; }
.profile-overview { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 16px; }
.profile-overview > div { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--subtle); border-radius: 8px; min-width: 0; }
.profile-overview strong { font-weight: 500; font-size: .9375rem; overflow-wrap: anywhere; }
.growth-dialog .detail-image.profile-avatar { object-fit: cover; border-radius: 50%; width: 80px; height: 80px; }
.profile-editor { margin-top: 16px; }
#profile-form { padding: 0 16px 16px; }
.profile-privacy-note { padding-bottom: 16px; }
.profile-fields { display: grid; gap: 16px; margin-block: 16px; }
.form-field select { width: 100%; min-width: 0; border: 1px solid var(--control-border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 10px 12px; min-height: 44px; font-size: 1rem; }
.avatar-editor { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.avatar-preview { border-radius: 50%; width: 80px; height: 80px; object-fit: cover; background: var(--surface); border: 1px solid var(--border); }
.avatar-editor > div { flex: 1; min-width: 180px; }
.avatar-editor input { max-width: 100%; }
#avatar-status { margin-top: 8px; }
#profile-save:disabled { opacity: .6; cursor: wait; }
.catalog-dialog { width: min(44rem, calc(100% - 32px)); }
.catalog-form { display: grid; gap: 14px; background: var(--subtle); border-radius: 10px; padding: 16px; margin-block: 20px; }
.catalog-form h3 { margin: 0; font-size: 1rem; }
.catalog-list { list-style: none; padding-left: 0; margin-block: 12px; }
.catalog-list .catalog-list { padding-left: 20px; border-left: 1px solid var(--border); margin-left: 8px; }
.catalog-group { margin-bottom: 12px; }
.catalog-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); min-height: 52px; }
.catalog-row > span { min-width: 0; overflow-wrap: anywhere; }
.catalog-actions { display: flex; gap: 4px; flex-shrink: 0; }
.catalog-actions .icon-button { width: auto; min-width: 44px; padding-inline: 8px; font-size: .8125rem; }
.catalog-actions .icon-button:last-child { color: var(--danger); }

@media (max-width: 639px) {
  .filter-toolbar { align-items: flex-start; flex-direction: column; gap: 4px; }
  .catalog-toolbar { align-self: flex-end; }
  .catalog-list .catalog-list { padding-left: 10px; margin-left: 4px; }
  .catalog-row { gap: 6px; }
}

@media (min-width: 640px) {
  .profile-overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .profile-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-form > h3, .catalog-form > p, .catalog-form > .form-actions { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Admin workbench and the pages built on top of the prototype stylesheet. */
.flash { padding: 12px 14px; border-radius: 8px; font-size: .875rem; line-height: 1.7; margin-block: 16px; }
.flash-ok { color: var(--primary); background: var(--primary-soft); }
.flash-warn { color: var(--warning); background: var(--warning-soft); }
.flash-error { color: var(--danger); background: var(--danger-soft); }
.container > .flash { margin-block: 24px 0; }

.bare-body { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.bare-shell { width: 100%; display: grid; place-items: center; }
.bare-card { width: min(30rem, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.bare-brand { margin-bottom: 20px; }
.bare-card h1 { font-size: 1.5rem; line-height: 1.5; margin-bottom: 12px; }
.stack-form { display: grid; gap: 16px; }

.admin-shell { display: grid; gap: 0; }
.admin-header { position: sticky; top: 0; z-index: 5; }
.admin-visit { display: none; }
.admin-nav { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; background: var(--subtle); border-bottom: 1px solid var(--border); }
.admin-nav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 7px; font-size: .875rem; color: var(--secondary); }
.admin-nav a:hover { background: var(--surface); }
.admin-nav a.is-current { background: var(--primary); color: var(--on-primary); }
.admin-main { width: min(100% - 2rem, 75rem); margin-inline: auto; padding-block: 24px calc(48px + env(safe-area-inset-bottom)); }
.admin-page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-page-header h1 { font-size: 1.5rem; line-height: 1.45; }
.admin-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.stat-card strong { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cover-thumb { border-radius: 8px; }
.admin-section { margin-top: 28px; }
.admin-section h2 { font-size: 1.125rem; margin-bottom: 12px; }
.task-list { list-style: none; display: grid; gap: 8px; }
.task-list li { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.task-reasons { color: var(--muted); font-size: .8125rem; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

.admin-form { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.admin-form h2 { font-size: 1.125rem; margin: 0; }
.admin-columns { display: grid; gap: 16px; }
.field-grid { display: grid; gap: 16px; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--secondary); font-size: .875rem; }
.check-field input { width: 20px; height: 20px; accent-color: var(--primary); }
.field-problem { display: block; color: var(--danger); font-size: .8125rem; line-height: 1.6; margin-top: 4px; }
.admin-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.admin-table { border-collapse: collapse; width: 100%; min-width: 720px; text-align: left; font-size: .875rem; }
.admin-table th { background: var(--subtle); color: var(--secondary); font-weight: 500; white-space: nowrap; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.category-list, .category-children { list-style: none; display: grid; gap: 8px; }
.category-children { padding-left: 16px; border-left: 1px solid var(--border); margin-top: 8px; }
.category-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.category-list input { flex: 1; min-width: 120px; }
.remove-button { min-height: 40px; padding: 4px 8px; color: var(--danger); font-size: .8125rem; }
.remove-button:hover { background: var(--danger-soft); border-radius: 6px; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.media-item figcaption { display: grid; gap: 2px; padding-top: 8px; font-size: .8125rem; color: var(--secondary); }

.turtle-page { padding-block: 24px 48px; }
.turtle-header { display: grid; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.turtle-identity { display: flex; align-items: center; gap: 16px; }
.turtle-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.turtle-identity h1 { font-size: 1.75rem; line-height: 1.35; }
.turtle-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; color: var(--muted); font-size: .8125rem; }
.turtle-tags span { border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; }
.growth-section, .timeline-section { margin-top: 28px; }
.range-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-placeholder { display: grid; place-items: center; width: 100%; height: 100%; background: var(--primary-soft); color: var(--primary); font-size: 2rem; font-weight: 600; }
.resident-photo .photo-placeholder { font-size: 2.5rem; }
.timeline { list-style: none; display: grid; gap: 12px; margin-top: 16px; }
.timeline-item { display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.timeline-date { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.timeline-date strong { font-size: 1rem; }
.timeline-date span { color: var(--muted); font-size: .8125rem; }
.timeline-values { display: flex; flex-wrap: wrap; gap: 16px; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.empty-garden { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 48px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.empty-garden .icon { width: 40px; height: 44px; color: var(--primary); }
.turtle-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.footer-note { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8125rem; }
a.primary-button { display: inline-flex; align-items: center; gap: 8px; }
.admin-inline-form { display: grid; gap: 12px; }
.record-form { display: grid; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.record-form-fields { display: grid; gap: 16px; }
.publish-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.publish-row form { display: inline-flex; gap: 8px; align-items: center; }
.danger-zone { margin-top: 32px; padding: 16px; border: 1px solid var(--danger); border-radius: 10px; }
.danger-zone h2 { color: var(--danger); }

@media (min-width: 640px) {
  .admin-main { width: min(100% - 3rem, 75rem); }
  .admin-nav { padding: 12px 24px; }
  .admin-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-form-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .turtle-header { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1024px) {
  .admin-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .admin-header { grid-column: 1 / -1; }
  .admin-nav { position: sticky; top: 80px; align-self: start; flex-direction: column; gap: 4px; overflow: visible; padding: 16px 12px; border-bottom: 0; border-right: 1px solid var(--border); background: var(--surface); }
  .admin-nav a { width: 100%; }
  .admin-visit { display: inline-flex; }
  .turtle-page { padding-block: 32px 64px; }
}
