:root {
  --green-950: #082713;
  --green-900: #0f3d1b;
  --green-800: #155724;
  --green-700: #1f7a32;
  --green-600: #238a3b;
  --green-500: #37a34a;
  --green-100: #eaf7ec;
  --green-050: #f6fbf7;
  --mint: #d9f7dd;
  --panel: rgba(255, 255, 255, 0.96);
  --ink: #1d2b22;
  --muted: #637469;
  --line: rgba(31, 122, 50, 0.17);
  --shadow-sm: 0 4px 14px rgba(8, 39, 19, 0.08);
  --shadow: 0 14px 36px rgba(8, 39, 19, 0.12);
  --radius: 8px;
  --tap: 44px;
  --nav-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 0 0, rgba(55, 163, 74, 0.16), transparent 22rem),
    linear-gradient(135deg, #f8fcf8 0%, #e7f4e9 100%);
}

body.nav-open {
  overflow: hidden;
}

img,
video {
  max-width: 100%;
}

a {
  color: var(--green-700);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.background {
  background:
    radial-gradient(circle at 0 0, rgba(55, 163, 74, 0.16), transparent 22rem),
    linear-gradient(135deg, #f8fcf8 0%, #e7f4e9 100%);
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 10px;
  z-index: 50000;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  background: var(--green-900);
  color: #fff;
  padding: 0 0.85rem;
}

.skip-link:focus {
  top: 10px;
}

header[role="banner"] {
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav[role="navigation"] {
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem max(0.75rem, env(safe-area-inset-left));
  background: rgba(8, 39, 19, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(8, 39, 19, 0.20);
  backdrop-filter: blur(14px);
}

.nav-left {
  min-width: 0;
}

.home-link {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  font-size: 1.16rem;
  font-weight: 850;
  letter-spacing: 0;
}

.home-link:hover {
  color: var(--mint);
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
}

.nav-toggle {
  width: var(--tap);
  height: var(--tap);
  display: inline-grid;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  display: block;
  border-radius: 99px;
  background: currentColor;
}

.nav-right {
  position: fixed;
  top: calc(var(--nav-height) + 0.55rem);
  left: 0.75rem;
  right: 0.75rem;
  z-index: 1001;
  display: none;
  max-height: min(70vh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(8, 39, 19, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.nav-right.active {
  display: grid;
  gap: 0.25rem;
}

.nav-right a,
.nav-button {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 760;
  text-align: left;
}

.nav-right a:hover,
.nav-button:hover,
.nav-right a.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--mint);
  text-decoration: none;
}

.nav-message-link {
  position: relative;
}

.nav-message-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  border-radius: 999px;
  background: #d94332;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
}

.main-content,
.app-shell {
  width: min(100% - 1rem, 1180px);
  margin: 0 auto;
}

.main-content {
  padding: 1rem 0 calc(3rem + env(safe-area-inset-bottom));
}

.page-heading,
.home-hero {
  display: grid;
  gap: 1rem;
  align-items: center;
  margin: 0.75rem 0 1.25rem;
}

.page-heading h1,
.home-hero h1 {
  margin: 0;
  color: var(--green-950);
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.page-heading p,
.home-hero p {
  max-width: 46rem;
  margin: 0.45rem 0 0;
  color: #425e4a;
}

.home-hero {
  text-align: center;
}

.home-hero-copy,
.home-hero-media {
  min-width: 0;
}

.home-hero .gm-actions {
  justify-content: center;
}

.home-hero-media {
  display: grid;
  place-items: center;
}

.home-hero-img {
  width: min(100%, 360px);
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gm-grid,
.gm-two-col,
.form-grid,
.feed-list,
.diary-list,
.conversation-list,
.admin-list {
  display: grid;
  gap: 1rem;
}

.gm-grid,
.gm-two-col {
  grid-template-columns: 1fr;
}

.gm-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  padding: 0.95rem;
}

.gm-card h2,
.gm-card h3,
.gm-card h4 {
  margin: 0 0 0.5rem;
  color: var(--green-950);
  line-height: 1.18;
}

.gm-muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.gm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin: 0.55rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.gm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.gm-button,
.btn-primary,
.btn-secondary {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.68rem 0.95rem;
  cursor: pointer;
  font: inherit;
  font-weight: 830;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.gm-button:hover,
.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.gm-button.primary,
.btn-primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  color: #fff;
  box-shadow: 0 9px 22px rgba(31, 122, 50, 0.22);
}

.gm-button.secondary,
.btn-secondary {
  background: #fff;
  color: var(--green-800);
  border-color: var(--line);
}

.gm-button:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

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

.form-field {
  min-width: 0;
  display: grid;
  gap: 0.38rem;
}

.form-field label {
  color: var(--green-950);
  font-weight: 820;
  font-size: 0.94rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  padding: 0.72rem 0.8rem;
}

.form-field textarea {
  min-height: 132px;
  resize: vertical;
}

.form-field input[type="file"] {
  padding: 0.62rem;
  background: var(--green-050);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: rgba(31, 122, 50, 0.55);
  box-shadow: 0 0 0 3px rgba(31, 122, 50, 0.12);
}

.post-card,
.diary-card {
  display: grid;
  gap: 0.8rem;
}

.post-card p,
.diary-card p,
.comment-item p,
.message-bubble p {
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 122, 50, 0.20);
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-950);
  font-size: 0.84rem;
  font-weight: 820;
  padding: 0.18rem 0.56rem;
}

.media-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.65rem;
}

.media-strip figure {
  min-width: 0;
  margin: 0;
}

.media-strip img,
.media-strip video,
.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--green-050);
}

figcaption {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  overflow: hidden;
  padding: 0;
}

.gallery-item img,
.gallery-item video {
  height: clamp(132px, 38vw, 220px);
  border-radius: var(--radius) var(--radius) 0 0;
}

.gallery-item .gm-actions {
  padding: 0 0.75rem 0.75rem;
}

.comment-box {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--green-050);
  padding: 0.85rem;
}

.comment-item {
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.comment-item:first-child {
  border-top: 0;
}

.status-message,
.alert {
  border-radius: var(--radius);
  margin: 0.75rem 0;
  padding: 0.75rem 0.9rem;
}

.status-message.success,
.alert-success {
  background: #dff4e3;
  color: #165b20;
}

.status-message.error,
.alert-error {
  background: #fde2e1;
  color: #7d1e18;
}

.status-message.info,
.alert-info {
  background: #e8f0ff;
  color: #24476d;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.profile-cover {
  min-height: clamp(150px, 42vw, 260px);
  background:
    linear-gradient(135deg, rgba(15, 61, 27, 0.78), rgba(55, 163, 74, 0.38)),
    linear-gradient(135deg, #cfead3, #f3fbf4);
  background-size: cover;
  background-position: center;
}

.profile-header {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.profile-avatar-large {
  width: 132px;
  height: 132px;
  display: block;
  border: 4px solid #fff;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--green-100);
  box-shadow: var(--shadow-sm);
}

.profile-header .gm-actions,
.profile-header .gm-meta {
  justify-content: center;
}

.chat-layout {
  display: grid;
  gap: 0.75rem;
}

.chat-layout > aside,
.chat-layout > section {
  min-width: 0;
}

.chat-layout > aside {
  padding: 0.8rem;
}

.chat-layout > aside h2 {
  margin-bottom: 0.65rem;
}

.conversation-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.conversation-item {
  min-width: min(78vw, 260px);
  width: auto;
  text-align: left;
  color: var(--ink);
  scroll-snap-align: start;
}

.conversation-item.active {
  border-color: rgba(31, 122, 50, 0.46);
  background: linear-gradient(180deg, #ffffff, #eef9f0);
  box-shadow: 0 0 0 3px rgba(31, 122, 50, 0.10);
}

.unread-chip {
  background: #dff4e3;
  border-color: rgba(31, 122, 50, 0.35);
}

.message-thread {
  min-height: 48vh;
  max-height: 58vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(246, 251, 247, 0.96), rgba(234, 247, 236, 0.96));
  padding: 0.8rem;
  scroll-behavior: smooth;
}

.message-bubble {
  width: fit-content;
  max-width: min(88%, 680px);
  margin: 0.45rem 0;
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 0.68rem 0.82rem;
}

.message-bubble.mine {
  margin-left: auto;
  border-radius: 16px 16px 5px 16px;
  background: #dff4e3;
}

.message-time {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

#message-form {
  position: sticky;
  bottom: calc(0.35rem + env(safe-area-inset-bottom));
  z-index: 2;
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem;
}

#message-form textarea {
  min-height: 88px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.age-gate,
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  background: rgba(5, 24, 10, 0.88);
}

.age-gate-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  padding: 1.15rem;
}

.age-gate-card h2 {
  margin-top: 0;
  color: var(--green-950);
}

.lightbox-content {
  max-width: min(920px, 96vw);
  max-height: 86vh;
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 82vh;
  border-radius: var(--radius);
}

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid rgba(31, 122, 50, 0.18);
  background: rgba(8, 39, 19, 0.96);
  color: #eefaf0;
}

.site-footer-inner {
  width: min(100% - 1rem, 1180px);
  display: grid;
  gap: 1rem;
  margin: 0 auto;
  padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom));
}

.footer-brand {
  display: grid;
  gap: 0.45rem;
}

.footer-brand p,
.footer-copy {
  max-width: 44rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.footer-links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-weight: 760;
}

.auth-card {
  max-width: 560px;
  margin-inline: auto;
}

.auth-helper-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.25rem;
}

.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
}

.password-toggle {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--green-050);
  color: var(--green-800);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 0.85rem;
}

.password-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ede5;
}

.password-meter span {
  width: 20%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #d94332;
  transition: width 0.18s ease, background 0.18s ease;
}

.password-meter span[data-score="2"],
.password-meter span[data-score="3"] {
  background: #d7a21a;
}

.password-meter span[data-score="4"],
.password-meter span[data-score="5"] {
  background: var(--green-600);
}

.legal-page {
  max-width: 920px;
}

.legal-document {
  display: grid;
  gap: 0.75rem;
  font-size: 1rem;
}

.legal-document h2 {
  margin: 0.4rem 0 0;
}

.legal-document p {
  margin: 0;
}

.contact-layout {
  align-items: start;
}

.contact-aside {
  position: static;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

pre {
  max-width: 100%;
  overflow: auto;
  border-radius: var(--radius);
  background: #f4f7f5;
  padding: 0.75rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2rem 0;
}

@media (min-width: 560px) {
  .main-content,
  .app-shell {
    width: min(100% - 1.5rem, 1180px);
  }

  .page-heading h1,
  .home-hero h1 {
    font-size: 2.35rem;
  }

  .form-row {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .gm-card {
    padding: 1rem;
  }
}

@media (min-width: 760px) {
  nav[role="navigation"] {
    padding-left: max(1rem, calc((100vw - 1180px) / 2));
    padding-right: max(1rem, calc((100vw - 1180px) / 2));
  }

  .main-content {
    padding-top: 1.5rem;
  }

  .page-heading {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .home-hero {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 1.5rem;
    text-align: left;
  }

  .home-hero .gm-actions {
    justify-content: flex-start;
  }

  .home-hero-img {
    width: min(100%, 420px);
    aspect-ratio: 16 / 11;
  }

  .gm-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .gm-two-col {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  }

  .profile-header {
    grid-template-columns: 150px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }

  .profile-avatar-large {
    width: 150px;
    height: 150px;
  }

  .profile-header .gm-actions,
  .profile-header .gm-meta {
    justify-content: flex-start;
  }

  .site-footer-inner {
    width: min(100% - 1.5rem, 1180px);
    grid-template-columns: minmax(0, 1.4fr) auto;
    align-items: start;
  }

  .footer-copy {
    grid-column: 1 / -1;
  }

  .contact-aside {
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
  }
}

@media (min-width: 920px) {
  .nav-toggle {
    display: none;
  }

  .nav-right,
  .nav-right.active {
    position: static;
    display: flex;
    max-height: none;
    overflow: visible;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-right a,
  .nav-button {
    justify-content: center;
    padding: 0.5rem 0.72rem;
  }

  .nav-message-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    margin-left: 0;
  }

  .page-heading h1,
  .home-hero h1 {
    font-size: 2.75rem;
  }

  .chat-layout {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1rem;
  }

  .conversation-list {
    display: grid;
    overflow: visible;
    padding-bottom: 0;
  }

  .conversation-item {
    min-width: 0;
    width: 100%;
  }

  .message-thread {
    min-height: 440px;
    max-height: 62vh;
    padding: 1rem;
  }

  #message-form {
    position: static;
  }
}

@media (min-width: 1200px) {
  .main-content {
    padding-top: 2rem;
  }

  .gm-card {
    padding: 1.1rem;
  }
}

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