/* Wallace HQ — minimal black */
:root {
  --brand: #ffffff;
  --brand-hover: #e5e5e5;
  --brand-mid: #cccccc;
  --brand-soft: #1a1a1a;
  --brand-glow: transparent;
  --brand-2: #aaaaaa;
  --brand-3: #888888;

  --ink: #f0f0f0;
  --ink-soft: #c8c8c8;
  --muted: #888888;
  --paper: #000000;
  --paper-2: #111111;
  --card: #111111;
  --line: #2a2a2a;
  --line-strong: #3a3a3a;

  --danger-bg: #2a1212;
  --danger-ink: #f5c2c2;
  --danger-line: #5c2020;
  --success-bg: #0f2418;
  --success-ink: #b6e0c8;
  --success-line: #1f4a30;

  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 960px;
  --header-h: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.5;
  background: #000;
  overflow-x: hidden;
}

a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: #ccc;
}

img {
  max-width: 100%;
}

/* ——— Header / brand ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  background: #000;
  border-bottom: 1px solid #222;
}

.nav-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-width: 0;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}

.brand:hover {
  color: #ccc;
}

.brand-crest,
.brand-mark,
.brand-text {
  display: none;
}

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0a0a0a;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: #666;
  background: #111;
  outline: none;
}

.nav-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 1.15rem;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 1px;
  background: #eee;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

.site-header.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-header.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.site-header.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-header nav {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  align-items: center;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  color: #bbb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: #fff;
  background: transparent;
}

.nav-links a.active {
  color: #fff;
  background: transparent;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-links a.btn-nav {
  background: transparent;
  color: #fff;
  margin-left: 0.25rem;
  border: 1px solid #444;
  box-shadow: none;
}

.nav-links a.btn-nav:hover {
  background: #111;
  color: #fff;
  border-color: #666;
}

/* Minimal public pages */
.main-minimal {
  padding-top: 2rem;
}

.philanthropy-intro {
  max-width: 36rem;
  margin: 0 0 1.5rem;
  color: #ccc;
  font-size: 1.02rem;
  line-height: 1.55;
}

/* Honeypot — visually hidden; not display:none so some bots still fill it */
.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.phil-requests-section {
  margin: 0 0 2rem;
}

.phil-requests-heading,
.phil-form-heading {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  color: #fff;
}

.phil-form-heading {
  margin-top: 0.5rem;
}

.phil-requests-note {
  margin: 0 0 1rem;
  color: #999;
  font-size: 0.9rem;
}

.phil-request-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.phil-request {
  border: 1px solid #333;
  border-left: 3px solid #fff;
  border-radius: 8px;
  background: #0a0a0a;
  padding: 0.9rem 1rem;
}

.phil-req-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.phil-req-org {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: #fff;
}

.phil-req-meta {
  margin: 0;
  font-size: 0.85rem;
  color: #aaa;
}

.phil-req-meta a {
  color: #ddd;
}

.phil-req-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #000;
  background: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.phil-req-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.phil-delete-form {
  margin: 0;
}

.phil-delete-form .btn-link.danger {
  font-size: 0.82rem;
  color: #f5a0a0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
}

.phil-delete-form .btn-link.danger:hover {
  color: #ffd0d0;
}

.phil-req-amount {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  color: #ddd;
}

.phil-req-message {
  margin: 0;
  white-space: pre-wrap;
  color: #ccc;
  font-size: 0.95rem;
  line-height: 1.5;
}

.main-minimal h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  letter-spacing: 0;
}

.simple-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.simple-links a {
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
}

.simple-links a:hover {
  text-decoration: underline;
}

/* Home page */
.home-page {
  max-width: 36rem;
}

.home-lead {
  margin: -0.5rem 0 1.25rem;
  color: #999;
  font-size: 0.95rem;
}

.home-welcome {
  margin: 0 0 0.75rem;
  color: #ccc;
  font-size: 1.05rem;
  line-height: 1.65;
}

.home-signoff {
  margin: 0 0 1.75rem;
  color: #aaa;
  font-size: 0.98rem;
}

.home-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.home-links a {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #0a0a0a;
  color: #fff;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.home-links a:hover {
  border-color: #555;
  background: #111;
  color: #fff;
}

.home-link-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.home-link-desc {
  display: block;
  font-size: 0.88rem;
  color: #888;
  line-height: 1.4;
  font-weight: 400;
}

.home-links a:hover .home-link-desc {
  color: #aaa;
}

/* ——— Layout ——— */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-hero {
  margin-bottom: 1.75rem;
}

.page-hero p {
  color: var(--ink-soft);
  max-width: 40rem;
  margin: 0;
  font-size: 1.05rem;
}

.eyebrow {
  display: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  color: var(--ink);
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.45rem, 2.8vw, 1.9rem);
  font-weight: 700;
}

h3 {
  font-weight: 600;
}

.lead {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 0 1.5rem;
  line-height: 1.65;
}

/* ——— Hero ——— */
.hero {
  display: grid;
  gap: 1.75rem;
  padding: 2rem 0 0.5rem;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    padding: 3rem 0 1.5rem;
    gap: 2.5rem;
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.hero-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.hero-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.stat {
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 0.9rem 0.55rem;
  text-align: center;
  border: 1px solid transparent;
}

.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.72rem 1.3rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #fff;
  color: #000;
  box-shadow: none;
}

.btn-primary:hover {
  background: #ddd;
  color: #000;
}

.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid #444;
  box-shadow: none;
}

.btn-secondary:hover {
  color: #fff;
  border-color: #888;
  background: #111;
}

/* ——— Sections / cards ——— */
.section {
  margin-top: 3.25rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 28rem;
  font-size: 0.98rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 700px) {
  .card-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .card-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #9db6d8;
}

/* Crest / motto hero */
.motto-translation {
  font-family: var(--motto);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--brand-mid);
  margin: -0.35rem 0 1rem;
  letter-spacing: 0.04em;
}

.motto-line {
  font-family: var(--motto);
  font-size: 1.2rem;
  color: var(--brand);
  margin: 0.25rem 0 0.85rem !important;
}

.crest-hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.75rem 1.5rem 1.5rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #eef4fb 100%);
  border: 1px solid var(--line);
}

.crest-hero-card::before {
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand));
}

.crest-large {
  width: min(200px, 55vw);
  height: auto;
  filter: drop-shadow(0 12px 24px var(--brand-glow));
}

.crest-caption {
  margin: 1rem 0 0 !important;
  font-family: var(--motto);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.06em;
}

.history-crest-block {
  display: grid;
  gap: 1.25rem;
  align-items: center;
}

@media (min-width: 700px) {
  .history-crest-block {
    grid-template-columns: auto 1fr;
    gap: 2rem;
  }
}

.history-crest-block img {
  width: 140px;
  height: auto;
  filter: drop-shadow(0 8px 18px var(--brand-glow));
}

/* ——— Family History page ——— */
.history-page {
  max-width: 44rem;
  padding-bottom: 3.5rem;
}

.history-page > h1 {
  margin-bottom: 0.35rem;
}

.history-lead {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

.history-source {
  margin: 0 0 1.5rem;
  color: #999;
  font-size: 0.92rem;
  line-height: 1.55;
  font-style: italic;
}

.history-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin: 0 0 2rem;
  padding: 0.85rem 0;
  border-top: 1px solid #2a2a2a;
  border-bottom: 1px solid #2a2a2a;
}

.history-toc a {
  font-size: 0.82rem;
  color: #ccc;
  text-decoration: none;
  border: 1px solid #333;
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.7rem;
  background: #0a0a0a;
}

.history-toc a:hover {
  color: #fff;
  border-color: #666;
  background: #151515;
}

.history-section {
  margin: 0 0 2.75rem;
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

.history-section h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0 0 0.85rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #2a2a2a;
  color: #fff;
  line-height: 1.3;
}

.history-years {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
}

.history-section p {
  margin: 0 0 1rem;
  color: #d0d0d0;
  font-size: 1.02rem;
  line-height: 1.65;
}

.history-note {
  margin-top: 1.25rem !important;
  padding: 0.85rem 1rem;
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  background: #0a0a0a;
  color: #aaa !important;
  font-size: 0.92rem !important;
}

.history-gallery {
  display: grid;
  gap: 1.1rem;
  margin: 1.15rem 0 0.5rem;
}

.history-gallery-2 {
  grid-template-columns: 1fr;
}

.history-gallery-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .history-gallery-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .history-gallery-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .history-gallery-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.history-fig {
  margin: 0;
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  background: #0a0a0a;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.history-fig img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28rem;
  object-fit: contain;
  background: #050505;
  vertical-align: middle;
}

.history-fig-wide {
  margin: 1.15rem 0 0.5rem;
}

.history-fig-wide img {
  max-height: 32rem;
}

.history-fig-clip {
  margin: 1.15rem 0 0.5rem;
  max-width: 28rem;
}

.history-fig-clip img {
  max-height: 36rem;
  object-fit: contain;
  object-position: top center;
  background: #fff;
}

.history-fig figcaption {
  padding: 0.65rem 0.8rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #999;
  border-top: 1px solid #222;
}

@media (max-width: 520px) {
  .history-fig img {
    max-height: 22rem;
  }

  .history-toc a {
    font-size: 0.78rem;
    padding: 0.24rem 0.55rem;
  }
}

.members-cta {
  border-left: 4px solid var(--brand);
}

.feature-card .icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  background: var(--brand-soft);
  border: 1px solid #c5d6eb;
}

.feature-card.sage .icon {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.feature-card.play .icon {
  background: #e8f0fa;
  border-color: #b7cce6;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin: 0;
}

.feature-card p {
  margin: 0;
  color: var(--ink-soft);
  flex: 1;
  font-size: 0.95rem;
}

.feature-card a.more {
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
  font-size: 0.92rem;
}

.feature-card a.more:hover {
  color: var(--brand-hover);
}

.panel {
  background: #0a0a0a;
  border: 1px solid #222;
  border-radius: var(--radius);
  box-shadow: none;
  padding: 1.25rem;
}

.panel-narrow {
  max-width: 720px;
}

/* ——— Forms ——— */
.form-stack {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-row.two {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input,
textarea,
select {
  font: inherit;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.9rem;
  background: #0a0a0a;
  color: #f0f0f0;
  width: 100%;
  transition: border-color 0.15s ease;
}

input:hover,
textarea:hover {
  border-color: #555;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #888;
  box-shadow: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[type="file"] {
  font: inherit;
  padding: 0.5rem 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

input[type="file"]:hover,
input[type="file"]:focus {
  border: none;
  box-shadow: none;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.93rem;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border: 1px solid var(--danger-line);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-ink);
  border: 1px solid var(--success-line);
}

.note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.muted-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

/* ——— Auth ——— */
.login-wrap {
  max-width: 420px;
  margin: 1.5rem auto 0;
}

.login-wrap.wide {
  max-width: 480px;
}

.login-wrap .page-hero {
  text-align: center;
}

.login-wrap .page-hero p {
  margin-left: auto;
  margin-right: auto;
}

/* ——— Family Connect feed ——— */
.composer {
  margin-bottom: 1.25rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.user-chip .avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.75rem;
}

.post-list {
  display: grid;
  gap: 1rem;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.post-meta strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.post-meta time {
  font-size: 0.78rem;
  color: var(--muted);
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--display);
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: none;
}

.post-body {
  margin: 0;
  white-space: pre-wrap;
  color: #f0f0f0;
  line-height: 1.6;
  font-size: 0.98rem;
}

.post-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 0;
}

.post-actions .btn-link.danger {
  color: #f88;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.avatar.avatar-photo {
  padding: 0;
  overflow: hidden;
  background: #222;
}

.avatar.avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-chip-link {
  margin-left: 0.35rem;
  font-size: 0.85rem;
  color: #aaa !important;
  text-decoration: underline !important;
}

.settings-chip-link:hover {
  color: #fff !important;
}

.settings-photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

.settings-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #333;
  background: #111;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.settings-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-photo-preview.placeholder {
  background: #fff;
  color: #000;
}

.settings-photo-forms {
  flex: 1;
  min-width: 14rem;
}

.files-panel-title {
  color: #fff;
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.post-photo {
  margin: 0.85rem 0 0.35rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f172a;
}

.post-photo img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #0f172a;
}

.empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
  color: #aaa;
  border: 1px dashed #444;
  border-radius: var(--radius);
  background: #0a0a0a;
}

.react-summary {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.react-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.react-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  margin: 0.65rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--line);
  width: 100%;
}

.react-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-pill);
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
}

.react-btn:hover {
  background: var(--brand-soft);
  transform: scale(1.08);
}

.react-btn.active {
  background: var(--brand-soft);
  border-color: #c7d2fe;
}

.comment .react-bar {
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  border-top: none;
}

.comments-block {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.comments-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-family: var(--font);
}

.comment-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.comment {
  background: var(--paper);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  border: 1px solid transparent;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}

.comment-head strong {
  font-size: 0.9rem;
}

.comment-head time {
  font-size: 0.75rem;
  color: var(--muted);
}

.comment p {
  margin: 0 0 0.25rem;
  white-space: pre-wrap;
  font-size: 0.93rem;
}

.comment-form textarea {
  min-height: 64px;
}

.comment-form .btn {
  justify-self: start;
}

/* ——— Games ——— */
.game-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 700px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.game-banner {
  height: 128px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: #fff;
  position: relative;
}

.game-banner.snake {
  background: linear-gradient(135deg, #059669, #10b981);
}
.game-banner.memory {
  background: linear-gradient(135deg, #4f46e5, #818cf8);
}
.game-banner.breakout {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}
.game-banner.wordle {
  background: linear-gradient(135deg, #0f766e, #2dd4bf);
}

.game-card .body {
  padding: 1.2rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.game-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.game-card p {
  margin: 0;
  color: var(--ink-soft);
  flex: 1;
  font-size: 0.95rem;
}

.game-shell {
  max-width: 640px;
  margin: 0 auto;
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.score-pill {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.95rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.canvas-wrap {
  background: #0f172a;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  border: 1px solid #1e293b;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.game-help {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.memory-card {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #4f46e5, #312e81);
  color: transparent;
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.memory-card.flipped,
.memory-card.matched {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.memory-card.matched {
  opacity: 0.7;
}

.memory-card:active {
  transform: scale(0.96);
}

.wordle-grid {
  display: grid;
  gap: 0.4rem;
  justify-content: center;
  margin: 1rem 0;
}

.wordle-row {
  display: grid;
  grid-template-columns: repeat(5, 3rem);
  gap: 0.4rem;
}

.wordle-cell {
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  background: #fff;
}

.wordle-cell.correct {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.wordle-cell.present {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}
.wordle-cell.absent {
  background: #64748b;
  border-color: #64748b;
  color: #fff;
}

.wordle-keys {
  display: grid;
  gap: 0.35rem;
  max-width: 480px;
  margin: 0 auto;
}

.wordle-keys .row {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}

.wordle-keys button {
  min-width: 2rem;
  height: 2.7rem;
  border: none;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.45rem;
}

.wordle-keys button.wide {
  min-width: 3.5rem;
  font-size: 0.75rem;
}

.wordle-keys button.correct {
  background: #059669;
  color: #fff;
}
.wordle-keys button.present {
  background: #d97706;
  color: #fff;
}
.wordle-keys button.absent {
  background: #64748b;
  color: #fff;
}

/* ——— Footer ——— */
.site-footer {
  border-top: 1px solid #222;
  margin-top: 2rem;
  padding: 1.25rem;
  color: #666;
  text-align: center;
  font-size: 0.85rem;
  background: transparent;
}

.site-footer strong {
  color: #aaa;
  font-weight: 600;
}

.site-footer p {
  margin: 0;
}

/* ——— Family Files shared drive ——— */
.files-breadcrumb {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.15rem;
  align-items: center;
}

.files-breadcrumb a {
  text-decoration: none;
  font-weight: 600;
  color: var(--brand);
}

.files-breadcrumb a:hover {
  text-decoration: underline;
}

.files-actions-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 800px) {
  .files-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .files-actions-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.files-panel-title {
  font-size: 1rem;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.files-browser {
  padding: 0;
  overflow: hidden;
}

.files-browser .files-panel-title {
  padding: 1.15rem 1.35rem 0;
}

.files-table-wrap {
  overflow-x: auto;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.files-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.files-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.files-table tbody tr:hover {
  background: #f8fafc;
}

.files-icon {
  width: 2.2rem;
  text-align: center;
  font-size: 1.1rem;
}

.files-name a {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.files-name a:hover {
  color: var(--brand);
}

.files-meta {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.86rem;
}

.files-actions {
  text-align: right;
  white-space: nowrap;
}

.files-actions .btn-link,
.files-actions a.btn-link {
  display: inline;
  margin-left: 0.65rem;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.files-actions .btn-link.danger,
.files-actions button.danger {
  color: #dc2626;
}

.inline-form {
  display: inline;
  margin: 0;
}

.files-browser .empty-state {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

/* ——— Family Calendar ——— */
.cal-create-form .cal-form-grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .cal-create-form .cal-form-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
  .cal-create-form .cal-form-grid-2 {
    grid-template-columns: 1fr 1.4fr;
    align-items: end;
  }
}

.cal-recur-hint {
  margin: 0;
  padding-bottom: 0.35rem;
  align-self: end;
}

.cal-recur-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #000;
  background: #fff;
  border-radius: var(--radius-pill);
}

.cal-pdf-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.9rem;
}

.cal-pdf-link:hover {
  background: #111;
  border-color: #888;
  color: #fff !important;
}

.cal-toolbar-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.25rem;
}

.cal-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.cal-filter-label select {
  min-width: 11rem;
  font-weight: 500;
}

.cal-view-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.cal-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  color: #aaa;
  text-decoration: none;
}

.cal-tab:hover {
  color: #fff;
  background: #1a1a1a;
}

.cal-tab.active {
  background: #fff;
  color: #000;
  box-shadow: none;
}

.cal-month-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.cal-month-title {
  margin: 0;
  flex: 1;
  min-width: 10rem;
  text-align: center;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.cal-list-title {
  text-align: left;
}

.cal-today-link {
  margin-left: 0.25rem;
}

.cal-body-panel {
  padding-top: 1rem;
}

.cal-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.cal-grid {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: #f0f0f0;
}

.cal-grid th {
  padding: 0.55rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ccc;
  background: #111;
  border-bottom: 1px solid #333;
  text-align: center;
}

.cal-grid td {
  vertical-align: top;
  height: 6.5rem;
  padding: 0.35rem;
  border-right: 1px solid #222;
  border-bottom: 1px solid #222;
  background: #0a0a0a;
  color: #f0f0f0;
}

.cal-grid tr td:last-child {
  border-right: none;
}

.cal-grid tr:last-child td {
  border-bottom: none;
}

.cal-day.other-month {
  background: #050505;
  color: #666;
}

.cal-day.is-today {
  background: #141414;
  box-shadow: inset 0 0 0 2px #fff;
}

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ddd;
  margin-bottom: 0.25rem;
  padding: 0 0.15rem;
}

.cal-day.is-today .cal-day-num {
  color: #fff;
}

.cal-day.other-month .cal-day-num {
  color: #555;
}

.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cal-chip {
  display: block;
  font-size: 0.68rem;
  line-height: 1.25;
  font-weight: 600;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #1a1a1a;
  border-left: 3px solid #fff;
}

.cal-chip:hover {
  background: #2a2a2a;
  color: #fff !important;
}

.cal-chip.type-birthday { border-left-color: #f472b6; }
.cal-chip.type-anniversary { border-left-color: #fb7185; }
.cal-chip.type-party { border-left-color: #fbbf24; }
.cal-chip.type-holiday { border-left-color: #4ade80; }
.cal-chip.type-appointment { border-left-color: #93c5fd; }
.cal-chip.type-travel { border-left-color: #67e8f9; }
.cal-chip.type-school { border-left-color: #c4b5fd; }
.cal-chip.type-other { border-left-color: #a3a3a3; }

.cal-more {
  font-size: 0.68rem;
  color: #999;
  font-weight: 600;
  padding: 0 0.2rem;
}

.cal-subhead {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.05rem;
  font-family: var(--display);
  color: #fff;
}

.cal-event-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cal-event-card {
  padding: 1rem 1.1rem;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  border-left: 4px solid #fff;
  box-shadow: none;
  color: #f0f0f0;
}

.cal-event-card.type-birthday { border-left-color: #f472b6; }
.cal-event-card.type-anniversary { border-left-color: #fb7185; }
.cal-event-card.type-party { border-left-color: #fbbf24; }
.cal-event-card.type-holiday { border-left-color: #4ade80; }
.cal-event-card.type-appointment { border-left-color: #93c5fd; }
.cal-event-card.type-travel { border-left-color: #67e8f9; }
.cal-event-card.type-school { border-left-color: #c4b5fd; }
.cal-event-card.type-other { border-left-color: #a3a3a3; }

.cal-event-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.cal-event-type {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.cal-event-date {
  font-size: 0.85rem;
  color: #bbb;
  font-weight: 500;
}

.cal-event-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-family: var(--display);
  letter-spacing: -0.02em;
  color: #fff;
}

.cal-event-desc {
  margin: 0 0 0.65rem;
  color: #ccc;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.cal-event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #aaa;
}

.cal-delete {
  display: inline;
  margin: 0;
}

.cal-delete .btn-link.danger,
.btn-link.danger {
  color: #f88 !important;
}

.cal-month-title {
  color: #fff;
}

/* ——— Family Recipes ——— */
.recipe-toolbar {
  align-items: flex-end;
}

.recipe-search-label {
  flex: 1;
  min-width: 12rem;
}

.recipe-search-label input[type="search"] {
  min-width: 100%;
}

.recipe-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .recipe-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 960px) {
  .recipe-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

a.recipe-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  border-left: 4px solid #fff;
  box-shadow: none;
  text-decoration: none;
  color: #f0f0f0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

a.recipe-card:hover {
  color: #fff;
  background: #111;
  border-color: #555;
}

.recipe-card.type-breakfast { border-left-color: #f59e0b; }
.recipe-card.type-lunch { border-left-color: #10b981; }
.recipe-card.type-dinner { border-left-color: #4f46e5; }
.recipe-card.type-dessert { border-left-color: #ec4899; }
.recipe-card.type-side { border-left-color: #14b8a6; }
.recipe-card.type-snack { border-left-color: #f97316; }
.recipe-card.type-drink { border-left-color: #0ea5e9; }
.recipe-card.type-other { border-left-color: #64748b; }

.recipe-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.recipe-card-cat {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.recipe-card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.recipe-card-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  flex: 1;
}

.recipe-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.recipe-view-cat {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.recipe-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.recipe-owner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.recipe-owner-actions form {
  margin: 0;
}

.recipe-lead {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.recipe-detail-grid {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

@media (min-width: 800px) {
  .recipe-detail-grid {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: start;
  }
}

.recipe-section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 1.15rem;
}

.recipe-list {
  margin: 0;
  padding-left: 1.25rem;
}

.recipe-list li {
  margin: 0.35rem 0;
}

.recipe-notes {
  white-space: pre-wrap;
  margin: 0;
  color: var(--ink-soft);
}

main > .recipe-section {
  max-width: var(--max);
  margin: 0 auto 1.5rem;
}

/* ——— Responsive / mobile ——— */
@media (max-width: 720px) {

  .site-header {
    height: auto;
    min-height: var(--header-h);
  }

  .nav-inner {
    flex-wrap: wrap;
    align-items: center;
    padding: 0.55rem 0.85rem;
    gap: 0;
  }

  .nav-bar {
    width: 100%;
    flex: 1 1 100%;
  }

  .brand {
    font-size: 1.05rem;
  }

  /* Show hamburger; hide link list until opened */
  .nav-toggle {
    display: inline-flex;
  }

  .site-header nav {
    display: none;
    width: 100%;
    flex: 1 1 100%;
    border-top: 1px solid #222;
    margin-top: 0.55rem;
    padding-top: 0.35rem;
  }

  .site-header.nav-open nav {
    display: block;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
    overflow: visible;
    margin: 0;
    padding: 0 0 0.35rem;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: flex;
    width: 100%;
    white-space: normal;
    font-size: 1rem;
    padding: 0.75rem 0.85rem;
    min-height: 2.75rem;
    border-radius: 8px;
  }

  .nav-links a.active {
    background: #151515;
    text-decoration: none;
    border-left: 3px solid #fff;
    padding-left: calc(0.85rem - 3px);
  }

  .nav-links a.btn-nav {
    margin-left: 0;
    margin-top: 0.25rem;
    justify-content: center;
    border-color: #555;
  }

  /* Prevent background scroll feel when menu is tall (iOS-friendly) */
  body.nav-menu-open {
    overflow: hidden;
    touch-action: none;
  }

  main {
    padding: 1.1rem 0.85rem 3rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .page-hero {
    margin-bottom: 1.1rem;
  }

  .page-hero p {
    font-size: 0.95rem;
  }

  .panel {
    padding: 1rem 0.9rem;
    border-radius: 8px;
  }

  .btn {
    min-height: 2.6rem;
    padding: 0.65rem 1rem;
    width: auto;
  }

  .form-stack label,
  .form-stack input,
  .form-stack select,
  .form-stack textarea,
  .form-stack button {
    max-width: 100%;
  }

  input,
  textarea,
  select {
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 0.7rem 0.8rem;
  }

  /* Family Connect */
  .user-chip {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    gap: 0.35rem 0.5rem;
    padding: 0.4rem 0.65rem 0.4rem 0.35rem;
    font-size: 0.85rem;
    border-radius: 12px;
  }

  .composer {
    margin-bottom: 1rem;
  }

  .post-card {
    padding: 0.9rem 0.85rem;
    border-radius: 10px;
  }

  .post-list {
    gap: 0.85rem;
  }

  .post-photo img {
    max-height: 70vh;
  }

  .react-summary,
  .react-bar {
    gap: 0.3rem;
  }

  .react-btn {
    min-width: 2.4rem;
    min-height: 2.4rem;
    font-size: 1.1rem;
  }

  .comment-form .btn {
    width: 100%;
  }

  .comments-block {
    margin-top: 0.75rem;
  }

  /* Calendar */
  .cal-form-grid,
  .cal-form-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cal-filter-label select {
    min-width: 0;
    width: 100%;
  }

  .cal-month-nav {
    justify-content: space-between;
    gap: 0.4rem;
  }

  .cal-month-title {
    font-size: 1.05rem;
    min-width: 0;
    order: -1;
    flex: 1 1 100%;
    text-align: center;
    margin-bottom: 0.25rem;
  }

  .cal-grid-wrap {
    margin: 0;
    padding: 0;
  }

  .cal-grid {
    min-width: 520px;
  }

  .cal-grid td {
    height: 4.5rem;
    padding: 0.2rem;
  }

  .cal-chip {
    font-size: 0.6rem;
    padding: 0.1rem 0.25rem;
  }

  /* Files / recipes / settings */
  .files-actions-grid {
    grid-template-columns: 1fr !important;
  }

  .settings-photo-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .settings-photo-forms {
    width: 100%;
  }

  a.recipe-card {
    background: #0a0a0a;
    color: #f0f0f0;
    border-color: #333;
  }

  a.recipe-card:hover {
    color: #fff;
  }

  .recipe-card-title {
    color: #fff;
  }

  .recipe-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .login-wrap,
  .login-wrap.wide {
    max-width: 100%;
  }

  .simple-links a {
    display: block;
    padding: 0.65rem 0;
    font-size: 1.1rem;
    border-bottom: 1px solid #222;
  }

  /* Games */
  #hf-canvas,
  #cf-canvas,
  #game {
    max-width: 100% !important;
    height: auto !important;
  }

  .hf-tools,
  .hf-battle-actions {
    gap: 0.35rem;
  }

  .hf-tools button,
  .hf-battle-actions button {
    font-size: 0.8rem;
    padding: 0.45rem 0.55rem;
  }

  .game-shell {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 400px) {
  .nav-links a {
    font-size: 0.95rem;
    padding: 0.7rem 0.75rem;
  }

  main {
    padding: 0.9rem 0.7rem 2.5rem;
  }

  .post-card {
    padding: 0.75rem 0.7rem;
  }
}
