:root {
  --app-vh: 100dvh;
  --app-visual-viewport-height: 100dvh;
  --app-visual-viewport-offset-top: 0px;
  --app-header-height: 70px;
  --app-footer-height: 52px;
  --app-footer-layout-height: 52px;
  --header-surface: var(--surface-color);
  --header-border-color: rgba(0, 0, 0, 0.04);
  --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  --header-backdrop-filter: none;
  --footer-surface: #1e293b;
  --footer-border-color: #334155;
  --footer-shadow: none;
  --footer-backdrop-filter: none;
}

/* Global Loader */
#app-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4000;
}

#boot-placeholder-layer {
  display: none;
}

.boot-placeholder {
  width: 100%;
  height: 100%;
}

.boot-stack {
  display: grid;
  gap: 0.8rem;
}

.boot-line,
.boot-circle {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.boot-line {
  height: 14px;
}

.boot-title-line {
  height: 22px;
}

.boot-circle {
  width: 44px;
  height: 44px;
}

.boot-card-block {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.w-16 {
  width: 16%;
}
.w-18 {
  width: 18%;
}
.w-20 {
  width: 20%;
}
.w-22 {
  width: 22%;
}
.w-24 {
  width: 24%;
}
.w-26 {
  width: 26%;
}
.w-32 {
  width: 32%;
}
.w-34 {
  width: 34%;
}
.w-36 {
  width: 36%;
}
.w-44 {
  width: 44%;
}
.w-46 {
  width: 46%;
}
.w-48 {
  width: 48%;
}
.w-56 {
  width: 56%;
}
.w-58 {
  width: 58%;
}
.w-62 {
  width: 62%;
}
.w-64 {
  width: 64%;
}
.w-68 {
  width: 68%;
}
.w-72 {
  width: 72%;
}
.w-74 {
  width: 74%;
}
.w-78 {
  width: 78%;
}
.w-80 {
  width: 80%;
}
.w-82 {
  width: 82%;
}
.w-84 {
  width: 84%;
}
.w-88 {
  width: 88%;
}
.w-90 {
  width: 90%;
}
.w-92 {
  width: 92%;
}
.w-96 {
  width: 96%;
}
.w-100 {
  width: 100%;
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.36),
    transparent
  );
  animation: skeletonShimmer 1.25s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  100% {
    transform: translateX(100%);
  }
}

body {
  margin: 0;
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow: hidden;
  min-height: var(--app-vh, 100dvh);
  height: var(--app-vh, 100dvh);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: var(--app-vh, 100dvh);
  height: var(--app-vh, 100dvh);
}

/*
 * Desktop windows can keep a stale pixel value in --app-vh after being
 * maximized (notably after the authenticated boot flow). Keep the shell tied
 * directly to the CSS viewport so the footer cannot remain at the old height.
 */
@media (min-width: 769px) {
  body,
  .app-container {
    min-height: 100vh;
    height: 100vh;
  }

  @supports (height: 100dvh) {
    body,
    .app-container {
      min-height: 100dvh;
      height: 100dvh;
    }
  }
}

body.app-booting header,
body.app-booting main,
body.app-booting #site-footer,
body.app-booting #auth-modal,
body.app-booting #auth-public-view {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.app-booting #app-loader {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  z-index: 4000;
}

body.app-booting #auth-modal,
body.app-booting #auth-public-view,
body.app-booting main,
body.app-booting #tree-section,
body.app-booting #profile-section,
body.app-booting #stemma-section,
body.app-booting #posts-section,
body.app-booting #ai-section,
body.app-booting #ai-proposals-section,
body.app-booting #gallery-section {
  transition: none;
  animation: none;
}

.boot-tree-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
}

.boot-tree-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Header */
header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  /* Extra bold for brand */
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.header-branding {
  display: flex;
  align-items: center;
  order: 1;
}

.header-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'branding controls actions';
  align-items: center;
  flex: 1;
  width: 100%;
  min-width: 0;
  column-gap: 1rem;
}

/* Hide PWA button on login screen */
header {
  background: var(--header-surface);
  padding: 1rem 1.25rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--header-border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--header-shadow);
  -webkit-backdrop-filter: var(--header-backdrop-filter);
  backdrop-filter: var(--header-backdrop-filter);
  position: relative;
  height: 70px; /* Fixed height for PC reliability */
  box-sizing: border-box;
}

.brand-aquino {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  color: #d97706;
  /* Amber-600 - Professional Gold */
  text-shadow: none;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-right: 2px;
}

.brand-tree {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--text-primary);
  font-size: 1.8rem;
  font-weight: 800;
  /* Extra bold for emphasis */
  letter-spacing: -0.01em;
  /* Tighter spacing for serif elegance */
}

.header-logo {
  height: 48px; /* Restored larger logo for PC */
  width: auto;
  margin-right: 0.5rem;
  object-fit: contain;
  transition: transform 0.2s;
  /* Smooth visual */
}

/* Ensure header content has enough height */
.header-branding {
  display: flex;
  align-items: center;
  height: 100%;
  grid-area: branding;
}

#controls {
  grid-area: controls;
  min-width: 0;
}

.header-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-area: actions;
  justify-self: end;
  margin-left: auto;
}

.header-top-actions > * {
  flex-shrink: 0;
}

.header-top-actions:empty {
  display: none;
}

body.auth-bootstrap-pending:not(.auth-public-view-active) .header-top-actions {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Main Area */
main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  overflow: clip;
}

/* Section Containers */
#upload-section {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-color: var(--bg-color);
  background-image: url('../background_login.jpg');
  background-size: cover;
  background-position: center;
  position: relative;
}

#upload-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
}

#tree-section,
#profile-section,
#stemma-section,
#posts-section,
#ai-section,
#ai-proposals-section,
#gallery-section {
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.35s;
}

.section-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}
#tree-section.section-visible,
#profile-section.section-visible,
#stemma-section.section-visible,
#posts-section.section-visible,
#ai-section.section-visible,
#ai-proposals-section.section-visible,
#gallery-section.section-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

#tree-section {
  cursor: grab;
}

#tree-section.mode-timeline,
#tree-section.mode-map,
#tree-section.mode-surnames {
  background: #0b1120 !important;
  background-color: #0b1120 !important;
  background-image: none !important;
}

#tree-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#e2e8f0 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  pointer-events: none;
  opacity: 0.7;
  z-index: 0;
}

#tree-section.mode-timeline::before,
#tree-section.mode-map::before,
#tree-section.mode-surnames::before {
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.08) 0.8px,
    transparent 0.8px
  ) !important;
  opacity: 0.8 !important;
}

#tree-section.mode-surnames,
#tree-section.mode-surnames:active {
  cursor: default;
}

#tree-section:not(.mode-tree) .print-tree-launch {
  display: none !important;
}

#tree-section:active {
  cursor: grabbing;
}

#tree-container {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
  overflow: clip;
}

#tree-warmup-progress-indicator {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 1100;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #334155;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

#tree-warmup-progress-indicator[data-state='pending'] {
  color: #1d4ed8;
}

#tree-warmup-progress-indicator[data-state='complete'] {
  color: #0f766e;
}

.tree-warmup-progress-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
}

.tree-warmup-progress-value {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.tree-warmup-progress-phase {
  display: inline-flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 88px;
}

.tree-warmup-progress-phase[data-phase='render'] .tree-warmup-progress-value {
  color: #1d4ed8;
}

.tree-warmup-progress-phase[data-phase='kinship'] .tree-warmup-progress-value {
  color: #0f766e;
}

.tree-warmup-progress-debug {
  max-width: 190px;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(51, 65, 85, 0.82);
  opacity: 0.86;
}

#ai-runtime-indicator {
  position: absolute;
  top: 96px;
  right: 12px;
  z-index: 1100;
  width: 210px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
  font-size: 0.68rem;
}

.ai-runtime-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-runtime-head button {
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.ai-runtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}
#ai-runtime-indicator[data-state='operational'] .ai-runtime-dot {
  background: #10b981;
}
#ai-runtime-indicator[data-state='suspended'] .ai-runtime-dot,
#ai-runtime-indicator[data-state='error'] .ai-runtime-dot {
  background: #ef4444;
}
.ai-runtime-state {
  margin: 3px 0 8px;
  font-weight: 800;
  color: #0f172a;
}
.ai-runtime-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
}
.ai-runtime-grid b {
  color: #0f172a;
  text-align: right;
}
.ai-runtime-note {
  margin-top: 8px;
  color: #64748b;
  line-height: 1.25;
}

@media (max-width: 768px) {
  #tree-warmup-progress-indicator {
    top: 8px;
    right: 8px;
  }

  #ai-runtime-indicator {
    top: 90px;
    right: 8px;
    width: 190px;
  }

  .tree-warmup-progress-debug {
    max-width: 160px;
  }
}

#profile-section,
#stemma-section,
#gallery-section,
#ai-section,
#ai-proposals-section,
#posts-section {
  overflow-y: auto;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  scroll-behavior: smooth;
}

.profile-container {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  min-height: 100%;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

.profile-header {
  position: relative;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
  height: 220px;
  margin-bottom: 0; /* Azzerato per permettere l'aggancio del nome tramite margine negativo */
  overflow: visible;
}

.profile-nav-buttons {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  gap: 8px;
  z-index: 1000;
}

.profile-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

/* Mobile Layout Optimization */
@media (max-width: 768px) {
  header {
    padding: 0.5rem 0.75rem; /* Shorter header on mobile */
    height: auto;
    min-height: 52px;
    align-items: flex-start;
  }

  .header-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'branding actions'
      'controls controls';
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 6px;
  }

  .header-branding {
    grid-area: branding;
    margin: 0;
    min-width: 0;
    justify-content: flex-start;
    width: auto;
    text-align: left;
  }

  #controls {
    grid-area: controls;
    justify-self: stretch;
    width: 100%;
  }

  .header-top-actions {
    grid-area: actions;
    width: auto;
    justify-content: flex-end;
    justify-self: end;
    margin-left: auto;
  }

  .header-logo {
    height: 32px; /* Smaller logo for compactness */
  }

  .brand-aquino {
    font-size: 1rem;
  }

  .brand-tree {
    font-size: 1.4rem;
  }

  .profile-header {
    height: 140px;
    margin-bottom: 0px;
  }

  .boot-tree-spinner .spinner {
    width: 42px;
    height: 42px;
    border-width: 4px;
  }
}

/* Footer - Desktop */
#site-footer {
  width: 100%;
  min-height: 52px;
  height: 52px;
  max-height: 52px;
  background: var(--footer-surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  box-sizing: border-box;
  font-size: 0.8rem;
  color: #cbd5e1;
  border-top: 1px solid var(--footer-border-color);
  flex-shrink: 0;
  gap: 1rem;
  flex-wrap: nowrap;
  overflow: hidden;
  z-index: 2000;
  box-shadow: var(--footer-shadow);
  -webkit-backdrop-filter: var(--footer-backdrop-filter);
  backdrop-filter: var(--footer-backdrop-filter);
}

#site-footer .footer-zone {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 100%;
  overflow: hidden;
}

#site-footer .footer-zone-left {
  justify-content: flex-start;
}

#site-footer .footer-session-line {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

#site-footer .footer-session-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease;
}

#site-footer .footer-session-button:not(:disabled):hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#site-footer .footer-session-button:focus-visible {
  border-radius: 4px;
  outline: 2px solid #a78bfa;
  outline-offset: 4px;
}

#site-footer .footer-session-button:disabled {
  cursor: default;
}

#site-footer .footer-points-wallet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px 8px;
  margin-left: 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fbbf24;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

#site-footer .footer-points-wallet:hover {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.1);
  transform: translateY(-1px);
}

#site-footer .footer-points-wallet:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

#site-footer .footer-points-wallet .material-symbols-outlined {
  font-size: 16px;
}

#site-footer .footer-points-separator {
  color: #475569;
  margin-right: 3px;
}

#site-footer .footer-zone-center {
  justify-content: center;
}

#site-footer .footer-zone-right {
  justify-content: flex-end;
}

#site-footer .footer-text {
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#site-footer .footer-text-left {
  color: #94a3b8;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#site-footer .footer-legal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#site-footer .footer-legal-link {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 650;
}

#site-footer .footer-legal-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

#site-footer .footer-legal-separator {
  color: #64748b;
}

#session-info.has-session::before {
  content: '|';
  margin: 0 12px;
  color: #475569;
  font-weight: normal;
}

@media (max-width: 480px) {
  #session-info.has-session::before {
    display: none;
  }
}

#site-footer .footer-lang-control {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  color: #cbd5e1;
  min-width: 0;
  margin-left: auto;
  white-space: nowrap;
}

#site-footer .footer-lang-label {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

#site-footer .footer-lang-label-short {
  display: none;
}

#site-footer .footer-lang-options {
  display: inline-flex;
  align-items: center;
}

#site-footer .footer-lang-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#site-footer .footer-lang-button {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 0.34rem 0.8rem;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

#site-footer .footer-lang-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

#site-footer .footer-lang-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 0 0 4px rgba(59, 130, 246, 0.28);
}

#site-footer .footer-lang-button.is-active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.92),
    rgba(37, 99, 235, 0.96)
  );
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

#site-footer .footer-lang-select-compact {
  display: none;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.3rem 2rem 0.3rem 0.85rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-width: 112px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23cbd5e1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px;
}

#site-footer .footer-lang-select-compact:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

#site-footer a.gold-text {
  color: #ffd700;
  text-decoration: none;
  font-weight: bold;
  transition: opacity 0.2s;
}

#site-footer a.gold-text:hover {
  opacity: 0.8;
  text-decoration: underline;
}

body.keyboard-open #site-footer {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

#site-footer {
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

/* Footer - Mobile */
@media (max-width: 480px) {
  :root {
    --app-footer-height: calc(74px + env(safe-area-inset-bottom));
    --app-footer-layout-height: calc(74px + env(safe-area-inset-bottom));
  }

  #site-footer {
    height: var(--app-footer-layout-height);
    min-height: var(--app-footer-layout-height);
    max-height: var(--app-footer-layout-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
    grid-template-rows: repeat(3, min-content);
    align-content: center;
    align-items: center;
    justify-items: center;
    justify-content: stretch;
    row-gap: 2px;
    column-gap: 7px;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    overflow: hidden;
    font-size: clamp(0.64rem, 2.8vw, 0.7rem);
    text-align: center;
    transition:
      transform 0.22s ease,
      opacity 0.22s ease,
      height 0.2s ease,
      min-height 0.2s ease;
  }

  #site-footer:has(#session-info:not(.has-session)) {
    height: calc(56px + env(safe-area-inset-bottom));
    min-height: calc(56px + env(safe-area-inset-bottom));
    max-height: calc(56px + env(safe-area-inset-bottom));
    grid-template-rows: repeat(2, min-content);
  }

  #site-footer #session-info:not(.has-session) {
    display: none;
  }

  #site-footer .footer-zone-left {
    display: contents;
  }

  #site-footer #record-count {
    grid-row: 1;
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    min-height: 0;
    align-items: center;
    justify-content: center;
    overflow: visible;
    text-align: center;
  }

  #site-footer .footer-session-line {
    grid-row: 2;
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
    gap: 3px;
  }

  #site-footer #session-info {
    display: block;
    max-width: none;
    min-width: 0;
    overflow: visible;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
  }

  #site-footer .footer-points-wallet {
    flex: 0 0 auto;
    margin-left: 0;
    padding: 3px 5px;
    white-space: nowrap;
  }

  #site-footer .footer-points-separator {
    margin-right: 1px;
  }

  #site-footer .footer-zone-center {
    grid-row: 3;
    grid-column: 2;
    display: flex;
    min-width: 0;
    height: auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    text-align: center;
  }

  #site-footer .footer-zone-right {
    grid-row: 3;
    grid-column: 3;
    display: flex;
    min-width: 0;
    height: auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    text-align: center;
  }

  #site-footer:has(#session-info:not(.has-session)) .footer-zone-center,
  #site-footer:has(#session-info:not(.has-session)) .footer-zone-right {
    grid-row: 2;
  }

  #site-footer .footer-legal-nav {
    gap: 3px;
    font-size: 0.65rem;
  }

  #site-footer .footer-association-link,
  #site-footer .footer-legal-nav .footer-legal-separator:first-of-type {
    display: none;
  }

  #site-footer .footer-text,
  #site-footer .footer-text-left {
    width: auto;
    margin: 0;
    overflow: visible;
    line-height: 1.2;
    white-space: nowrap;
  }

  #site-footer .footer-lang-control {
    width: auto;
    min-width: 0;
    justify-content: center;
    gap: 0.25rem;
    margin: 0;
  }

  #site-footer .footer-lang-label-full {
    display: none;
  }

  #site-footer .footer-lang-label-short {
    display: inline;
  }

  #site-footer .footer-lang-buttons {
    display: none;
  }

  #site-footer .footer-lang-select-compact {
    display: inline-flex;
    min-width: 54px;
    min-height: 24px;
    padding: 0.16rem 1.15rem 0.16rem 0.4rem;
    font-size: 0.66rem;
    line-height: 1;
  }
}

@media (max-width: 768px) {
  #profile-section,
  #stemma-section,
  #gallery-section,
  #ai-section,
  #ai-proposals-section,
  #posts-section {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  #profile-section::-webkit-scrollbar,
  #stemma-section::-webkit-scrollbar,
  #gallery-section::-webkit-scrollbar,
  #ai-section::-webkit-scrollbar,
  #ai-proposals-section::-webkit-scrollbar,
  #posts-section::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}
