/* Ilova uslublari (kirish, daraxt, panel) — landing.css dagi dizayn tili asosida.
   Ranglar va shriftlar landing.css :root dan olinadi: --ink --muted --paper --line --serif --sans */
:root {
  --pine-hover: #3c5b45;
  --sage-soft: #edf3e9;
  --sage-line: #b8c9b3;
  --card-line: #e8ebe4;
  --danger: #a8554d;
}

/* portret ranglari (landing.css dagi .avatar-* bilan bir xil) */
.avatar2.sage { background: linear-gradient(145deg, #bdc8af, #778b70); }
.avatar2.rose { background: linear-gradient(145deg, #d5b4a3, #9a7169); }
.avatar2.blue { background: linear-gradient(145deg, #adc4be, #607f78); }
.avatar2.amber { background: linear-gradient(145deg, #ddc397, #a37e51); }
.app-brand .brand-word { font-size: 15px; }

/* bosh sahifadagi haqiqiy suratlar */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.memory-photo-placeholder.has-photo { background: url("/assets/people/xotira.jpg") center / cover; filter: sepia(.25); }

html, body { height: 100%; }
#root { min-height: 100%; }
.hidden { display: none !important; }

.icon { flex: none; vertical-align: middle; }
button { cursor: pointer; }
button .icon { pointer-events: none; }

/* prototipdagi kamchilik: yakuniy blok animatsiyasi matnni joyidan siljitardi */
.closing-content { animation: fadeUp .8s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.site-header .mobile-nav a { display: flex; align-items: center; gap: 8px; }

/* ===== Bosganda suv to'lqini ===== */
.click-ripple {
  position: fixed; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; pointer-events: none; z-index: 9999;
  border: 1.5px solid rgba(113, 135, 118, 0.6);
  animation: rippleExpand 0.62s cubic-bezier(.22,.61,.36,1) forwards;
}
.click-ripple.r2 { animation-duration: 0.9s; border-color: rgba(214, 201, 172, 0.55); }
@keyframes rippleExpand {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(11); opacity: 0; }
}

/* ===== Tugmalar ===== */
.btn-primary, .btn-ghost, .btn-sm, .icon-btn, .script-toggle {
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans);
}
.btn-primary {
  justify-content: center; border: 0; border-radius: 4px;
  background: var(--pine); color: #fff; padding: 14px 18px;
  font-size: 13px; font-weight: 600; letter-spacing: .1px;
  transition: transform .2s, background .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-2px); background: var(--pine-hover); box-shadow: 0 10px 24px rgba(58,82,62,.18); }
.btn-ghost, .icon-btn {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 9px 13px; border-radius: 4px; font-size: 12px;
  transition: border-color .2s, background .2s;
}
.icon-btn { padding: 9px; }
.btn-ghost:hover, .icon-btn:hover { border-color: var(--sage-line); background: #fdfdfb; }
.script-toggle { font-weight: 600; }

/* ===== Kirish ekrani (shom manzarasi ustida) ===== */
.auth-wrap {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; background: #f4f2ea;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 100px 22px 40px;
}
.auth-wrap:before { content: ""; position: absolute; inset: 0; z-index: -2; opacity: .6;
  background: radial-gradient(ellipse at 84% 30%, #e5e9dc 0, transparent 36%), radial-gradient(ellipse at 13% 88%, #ece8db 0, transparent 40%); }
.auth-top {
  position: absolute; inset: 0 0 auto; height: 76px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 clamp(22px, 6vw, 88px);
  background: rgba(248,247,242,.94); border-bottom: 1px solid rgba(38,54,45,.09);
}
.auth-top .back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #657067; cursor: pointer; }
.auth-top .back-link:hover { color: #4e7258; }
.auth-card {
  width: 100%; max-width: 420px; background: rgba(255,255,252,.96);
  border: 1px solid #e5e7de; border-radius: 7px;
  box-shadow: 0 18px 55px rgba(45,62,47,.09); padding: 34px 32px 30px;
  animation: fadeUp .6s ease both;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark { margin: 0 auto 14px; width: 44px; height: 44px; background: #e8ede5; color: #58745d; display: grid; }
.auth-brand h1 { font: 400 34px/1.1 var(--serif); letter-spacing: -1px; margin: 0 0 8px; color: var(--ink); }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.auth-tabs { display: flex; gap: 26px; justify-content: center; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 0 2px 11px; font: 600 12px var(--sans);
  color: #9aa097; letter-spacing: .3px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: #506b55; border-bottom-color: var(--pine); }

.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-foot { margin-top: 18px; display: flex; gap: 8px; justify-content: center; }

.inp, select.inp, textarea.inp {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 4px;
  font: 13px var(--sans); background: #fff; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.inp::placeholder { color: #a4aaa2; }
.inp:focus { outline: none; border-color: var(--sage-line); box-shadow: 0 0 0 3px rgba(113,135,118,.14); }
textarea.inp { resize: vertical; }
.row { display: flex; gap: 10px; }
.row .inp { flex: 1; }
.invite-note { background: var(--sage-soft); color: #506b55; border: 1px solid #dce6d8;
  padding: 11px 13px; border-radius: 5px; font-size: 12px; line-height: 1.6; }
.form-msg { color: var(--danger); font-size: 12px; min-height: 16px; text-align: center; }
hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }

/* ===== Asosiy ekran ===== */
.app { height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.topbar {
  height: 68px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 40px); background: rgba(250,249,245,.94);
  border-bottom: 1px solid rgba(33,44,37,.08); box-shadow: 0 5px 24px rgba(20,30,23,.045); z-index: 5;
}
.app-brand .brand-mark { background: #e8ede5; color: #58745d; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.me-name { color: var(--muted); font-size: 12px; margin-right: 6px; }
.hint { flex: none; color: #868e86; font: italic 13px/1.5 var(--serif); padding: 9px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line); background: #f7f5ef; }

.tree-box { flex: 1; overflow: hidden; position: relative;
  background: radial-gradient(ellipse at 50% 45%, rgba(220,226,214,.7), transparent 62%), var(--paper); }
.tree-svg { width: 100%; height: 100%; cursor: grab; display: block; }
.tree-svg.grabbing { cursor: grabbing; }

.edge-parent { fill: none; stroke: #ced8cb; stroke-width: 1.5; }
.edge-spouse { stroke: #d6c9ac; stroke-width: 1.5; stroke-dasharray: 3 4; }

.node { cursor: pointer; }
.node-box { fill: #fff; stroke: var(--card-line); stroke-width: 1.2;
  filter: drop-shadow(0 5px 14px rgba(42,57,43,.07)); transition: stroke .2s; }
.node:hover .node-box { stroke: var(--sage-line); }
.node-root .node-box { stroke: var(--sage-line); stroke-width: 1.6; filter: drop-shadow(0 6px 17px rgba(76,111,79,.16)); }
.node-dead .node-box { stroke-dasharray: 5 3; }
.node-name { text-anchor: start; font: 600 14px var(--sans); fill: #374138; }
.node-years { text-anchor: start; font: 11.5px var(--sans); fill: #9aa097; }
.node-initials { text-anchor: middle; font: 18px var(--serif); fill: #fff; }
.node-badge { fill: var(--sage-soft); }
.node-badge-text { text-anchor: middle; font: 9.5px var(--sans); fill: #6a8b6d; }

/* ===== Yon panel ===== */
.panel-overlay { position: fixed; inset: 0; background: rgba(24,34,30,.32); backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end; z-index: 60; }
.panel { width: 380px; max-width: 94vw; height: 100%; background: var(--paper);
  border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(43,58,44,.16);
  padding: 26px 24px; overflow-y: auto; animation: slideIn .25s ease; }
@keyframes slideIn { from { transform: translateX(26px); opacity: .4; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; align-items: flex-start; gap: 14px; }
.panel-head h2 { margin: 0; font: 400 26px/1.15 var(--serif); letter-spacing: -.6px; color: var(--ink); }
.panel-head-info { min-width: 0; }
.panel-head-info h2 { word-break: break-word; }
.panel-close { margin-left: auto; flex: none; border: 1px solid var(--line); background: #fff; width: 30px; height: 30px;
  border-radius: 4px; color: #798079; display: grid; place-items: center; }
.panel-close:hover { border-color: var(--sage-line); color: var(--ink); }
.panel-life { color: #9aa097; font-size: 12px; margin-top: 6px; }
.panel-badge { color: var(--danger); font-size: 11px; margin-top: 3px; }
.panel-bio { color: #747b75; font: italic 14px/1.65 var(--serif); margin: 18px 0 0; padding-left: 14px; border-left: 2px solid #dfe7dc; }
.panel-sub { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 12px 0; }

/* monogramma portret (ranglari landing.css: .sage .rose .blue .amber) */
.avatar2 { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  overflow: hidden; color: #fff; font: 21px var(--serif); box-shadow: inset 0 -11px 0 rgba(0,0,0,.07), 0 5px 14px rgba(50,65,53,.12); }
.avatar2.root { outline: 2px solid var(--sage-line); outline-offset: 2px; }
.avatar2 img { width: 100%; height: 100%; object-fit: cover; }

.panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.btn-sm { justify-content: flex-start; text-align: left; background: #fff; border: 1px solid var(--card-line);
  padding: 12px 13px; border-radius: 5px; font-size: 12.5px; color: #374138;
  box-shadow: 0 5px 14px rgba(42,57,43,.035); transition: border-color .2s, transform .2s; }
.btn-sm .icon { color: #86935c; }
.btn-sm:hover { border-color: var(--sage-line); transform: translateX(2px); }
.btn-sm.invite { background: var(--sage-soft); border-color: #dce6d8; color: #506b55; }
.btn-sm.invite .icon { color: #506b55; }
.btn-sm.danger { color: var(--danger); }
.btn-sm.danger .icon { color: var(--danger); }

.edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: #778179; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; font-size: 12px; font-weight: 400;
  letter-spacing: 0; text-transform: none; color: var(--ink); }
.edit-buttons { display: flex; gap: 10px; margin-top: 8px; }
.edit-buttons .btn-primary { flex: 1; }

.photo-field { display: flex; align-items: center; gap: 14px; }
.photo-preview { width: 74px; height: 74px; border-radius: 50%; background: #e8ede5; color: #58745d;
  display: grid; place-items: center; overflow: hidden; flex: none; border: 2px solid #fff; box-shadow: 0 5px 14px rgba(50,65,53,.12); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls { display: flex; flex-direction: column; gap: 6px; }
.photo-controls .btn-sm { padding: 8px 11px; font-size: 11.5px; }
.photo-status { font-size: 11px; color: var(--muted); }

@media (max-width: 720px) {
  .topbar { height: 60px; }
  .me-name, .hint { display: none; }
  .app-brand small, .app-brand .brand-light { display: none; }
  .auth-card { padding: 28px 22px 24px; }
}
@media (prefers-reduced-motion: reduce) { .click-ripple { display: none; } }

/* ===== Daraxt kartalari: to'rtburchak, tepada jins rangi (ko'k - o'g'il, qizil - qiz) ===== */
.node-box { fill: #fff; stroke: #d9dde2; stroke-width: 1.2; filter: drop-shadow(0 4px 12px rgba(30,40,50,.08)); }
.node-m .node-box { stroke: #9cc6f2; }
.node-f .node-box { stroke: #f1a9ab; }
.node:hover .node-box { stroke-width: 2; }
.node-root .node-box { stroke-width: 2.2; filter: drop-shadow(0 6px 18px rgba(30,40,50,.16)); }
.node-dead .node-box { stroke-dasharray: 5 3; }
.node-avatar-bg { fill: #eef0f2; }
.node-avatar-ring { fill: none; stroke: #e1e4e8; stroke-width: 1.2; }
.node-silhouette { fill: #c3c8ce; }
.node-silhouette .sil-hair { fill: #9aa1a9; }
.node-name { text-anchor: middle; font: 600 14px var(--sans); fill: #1f2933; }
.node-years { text-anchor: middle; font: 12px var(--sans); fill: #8a929b; }
.edge-parent { fill: none; stroke: #c4c9cf; stroke-width: 1.4; }
.edge-spouse { stroke: #c4c9cf; stroke-width: 1.4; stroke-dasharray: none; }
.edge-dot { fill: #aab1b9; }
.tree-box { background-image: radial-gradient(circle at 1px 1px, rgba(30,40,50,.13) 1px, transparent 0); background-size: 26px 26px; background-color: var(--paper); }

/* kelin / kuyov: oilaga nikoh orqali kirganlar — fonida iliq tus va belgi */
.node-inlaw .node-box { fill: #faf5ea; stroke-dasharray: 6 4; }
.node-inlaw-badge { fill: #efe6d0; }
.node-inlaw-text { text-anchor: middle; font: 600 10.5px var(--sans); fill: #8a7440; }
