/* ─── BASE – Readwoods ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:    #141512;
  --bg-dark:    #191f14;
  --bg-card:    #2b1414;
  --bg-panel:   #212c12;
  --border:     rgba(111, 143, 80, 0.28);
  --text-light: #1f2e20;
  --text-muted: #5d6f58;
  --accent:     #222a1c;
  --accent2:    #181c18;
  --accent3:    #212220;
  --danger:     #1c1616;
  --radius:     12px;
  --shadow:     0 10px 24px rgba(40, 72, 30, 0.14);
  --font-serif: 'Merriweather', Georgia, serif;
  --font-sans:  'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
}

.site-logo {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  border-radius: 8px;
  overflow: hidden;
}

.site-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 40px;
  background: rgba(10, 14, 11, 0.9);
  border-bottom: 1px solid rgba(130, 156, 118, 0.24);
  backdrop-filter: blur(10px);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.nav__name {
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #f6fbff;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav__links a {
  color: #cbdeef;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.nav__links a:hover {
  color: #ffffff;
}

.nav__cta,
.nav__tree-link,
.nav__stats-link {
  background: rgba(87, 201, 122, 0.16);
  border: 1px solid rgba(87, 201, 122, 0.42);
  color: #91eba4;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 800;
}

.nav-menu,
.nav-profile {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-block: 10px;
  margin-block: -10px;
}

.nav-menu__trigger {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.nav-menu__panel,
.nav-profile__panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 250;
  min-width: 190px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(130, 156, 118, 0.28);
  border-radius: 8px;
  background: rgba(12, 18, 13, 0.97);
  box-shadow: 0 18px 38px rgba(5, 10, 6, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.nav-menu__panel {
  left: 0;
  right: auto;
}

.nav-menu__panel::before,
.nav-profile__panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.nav-menu:hover .nav-menu__panel,
.nav-menu:focus-within .nav-menu__panel,
.nav-profile:hover .nav-profile__panel,
.nav-profile:focus-within .nav-profile__panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-menu__panel a,
.nav-profile__panel a {
  display: block;
  padding: 11px 12px;
  border-radius: 6px;
  color: #dbece0;
  white-space: nowrap;
}

.nav-menu__panel a:hover,
.nav-profile__panel a:hover {
  background: rgba(95, 143, 63, 0.18);
  color: #ffffff;
}

.user-avatar {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  border: 1px solid rgba(226, 175, 46, 0.45);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff6cf, #dfe9c8 46%, #486a36 100%);
  color: #1a2a16;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(28, 45, 22, 0.2);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.user-avatar:hover,
.user-avatar:focus-visible {
  border-color: #e2af2e;
  box-shadow: 0 10px 24px rgba(35, 62, 28, 0.28);
  transform: translateY(-1px) scale(1.04);
  outline: none;
}

.user-avatar__symbol {
  font-size: 1.45rem;
  line-height: 1;
}

.user-avatar__name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.nav__links .user-avatar,
.community-nav__links .user-avatar {
  padding: 0;
  margin-left: 4px;
}

.profile-page {
  min-height: calc(100vh - 74px);
  padding: 112px 22px 52px;
  background:
    linear-gradient(135deg, rgba(244, 236, 211, 0.95), rgba(218, 233, 215, 0.96)),
    radial-gradient(circle at 20% 20%, rgba(226, 175, 46, 0.22), transparent 34%);
  color: #1e2b1a;
}

.profile-panel,
.profile-form {
  width: min(100%, 760px);
  margin: 0 auto;
}

.profile-panel {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 22px;
}

.profile-preview {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7d7, #b9d7a7 52%, #40612f);
  box-shadow: 0 18px 34px rgba(40, 72, 30, 0.22);
}

.profile-preview span {
  font-size: 3.35rem;
  line-height: 1;
}

.profile-copy h1 {
  margin: 5px 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
}

.profile-copy p:last-child {
  max-width: 560px;
  color: #52604d;
  line-height: 1.6;
}

.profile-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  padding: 24px;
  border: 1px solid rgba(91, 116, 68, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 36px rgba(40, 72, 30, 0.13);
}

.profile-form label,
.avatar-picker legend {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #26331f;
}

.profile-form input[type="text"],
.profile-form textarea {
  width: 100%;
  border: 1px solid rgba(91, 116, 68, 0.32);
  border-radius: 8px;
  background: #fffdf7;
  color: #1e2b1a;
  font: inherit;
  padding: 11px 12px;
  outline: none;
}

.profile-form input[type="text"]:focus,
.profile-form textarea:focus {
  border-color: #5f8f3f;
  box-shadow: 0 0 0 3px rgba(95, 143, 63, 0.18);
}

.avatar-picker {
  border: 0;
}

.avatar-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.avatar-choice {
  min-height: 112px;
  place-items: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(91, 116, 68, 0.26);
  border-radius: 8px;
  background: #fffdf7;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.avatar-choice:hover {
  transform: translateY(-2px);
  border-color: #5f8f3f;
  box-shadow: 0 10px 22px rgba(40, 72, 30, 0.13);
}

.avatar-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice:has(input:checked) {
  border-color: #e2af2e;
  background: linear-gradient(145deg, #fff8dc, #e7f2dc);
  box-shadow: 0 0 0 3px rgba(226, 175, 46, 0.22);
}

.avatar-choice__symbol {
  font-size: 2.25rem;
  line-height: 1;
}

.avatar-choice__label {
  font-size: 0.86rem;
  color: #52604d;
}

.profile-message {
  border: 1px solid rgba(95, 143, 63, 0.34);
  border-radius: 8px;
  background: rgba(95, 143, 63, 0.12);
  color: #28451e;
  padding: 10px 12px;
  font-weight: 700;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 720px) {
  .user-avatar {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .profile-page {
    padding: 100px 14px 36px;
  }

  .profile-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-preview {
    margin: 0 auto;
  }

  .profile-copy p:last-child {
    margin: 0 auto;
  }

  .profile-form {
    padding: 18px;
  }

  .avatar-picker__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn--primary {
  background: linear-gradient(135deg, #edc996, #e2af2e);
  color: #111010;
  box-shadow: 0 6px 16px rgba(95, 143, 63, 0.3);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #5f8f3f, #e2af2e);
  box-shadow: 0 8px 18px rgba(95, 143, 63, 0.34);
  transform: translateY(-1px);
}
.btn--ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: rgba(123, 170, 77, 0.14);
  border-color: var(--accent);
}
.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover { background: #efcaca; }
.btn--lg { padding: 14px 32px; font-size: 1.05rem; border-radius: 10px; }
.btn--sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #e2f2d5; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.auth-card {
  width: min(100%, 460px);
  border: 1px solid rgba(151, 176, 201, 0.25);
  background: rgba(17, 25, 35, 0.92);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.35);
}

.auth-back {
  display: inline-flex;
  margin-top: 12px;
  color: #9dd5ff;
  text-decoration: none;
  font-size: 0.88rem;
}

.auth-back:hover {
  color: #d5ecff;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f6fbff;
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 700;
}

.auth-card h1 {
  margin: 12px 0 8px;
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1.2;
}

.auth-sub {
  color: #a8bbcf;
  margin-bottom: 18px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  font-size: 0.87rem;
  font-weight: 600;
  color: #d5e6f6;
  margin-top: 2px;
}

.auth-form input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(150, 178, 203, 0.34);
  background: rgba(7, 12, 17, 0.7);
  color: #eef8ff;
  font-size: 0.95rem;
  padding: 11px 12px;
  outline: none;
}

.auth-form input:focus {
  border-color: #67cc88;
  box-shadow: 0 0 0 2px rgba(87, 201, 122, 0.2);
}

.auth-submit {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.auth-meta {
  margin-top: 14px;
  font-size: 0.88rem;
  color: #aac0d5;
}

.auth-meta a {
  color: #9dd5ff;
  text-decoration: none;
}

.auth-message {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.auth-message a {
  color: #d9f0ff;
}

.auth-message--ok {
  background: rgba(78, 198, 120, 0.18);
  border: 1px solid rgba(87, 201, 122, 0.45);
  color: #bff3cf;
}

.auth-message--error {
  background: rgba(224, 91, 91, 0.14);
  border: 1px solid rgba(224, 91, 91, 0.45);
  color: #ffd6d6;
}

.field-error {
  color: #ffb7b7;
  font-size: 0.8rem;
  margin-top: -4px;
}
