/* Raiul Fionei — tot stilul paginii: ecranul de încărcare, HUD-ul, familia, controalele, panoul,
   jurnalul, notificările, legenda, bun-venitul și etichetele 3D (CSS2D).
   Identitatea: sticlă albă-translucidă, colțuri mari, accente piersică / roz / mentă / auriu.
   Noaptea (body.night): sticlă indigo. Fără fonturi externe. */

:root {
  --ink: #45374f;
  --ink-soft: #7a6c86;
  --ink-faint: #a698b2;
  --glass: rgba(255, 250, 249, 0.74);
  --glass-2: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 252, 250, 0.9);
  --line: rgba(255, 255, 255, 0.8);
  --line-soft: rgba(120, 90, 140, 0.12);
  --peach: #ffb08c;
  --pink: #f792b4;
  --rose: #ffd1df;
  --mint: #74d3ae;
  --gold: #f4bb4f;
  --sky: #7cc3ee;
  --lilac: #b29ee8;
  --accent: #f0789e;
  --accent-ink: #b8466c;
  --shadow: 0 12px 32px rgba(112, 72, 124, 0.16), 0 2px 6px rgba(112, 72, 124, 0.08);
  --shadow-soft: 0 4px 14px rgba(112, 72, 124, 0.12);
  --blur: blur(16px) saturate(1.35);
  --r: 20px;
  --r-sm: 13px;
  --gap: 14px;
  --left-w: 272px;
  --panel-w: 372px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

body.night {
  --ink: #f3efff;
  --ink-soft: #c4bdea;
  --ink-faint: #9289c6;
  --glass: rgba(38, 36, 92, 0.58);
  --glass-2: rgba(70, 64, 150, 0.32);
  --glass-strong: rgba(36, 33, 86, 0.9);
  --line: rgba(196, 186, 255, 0.24);
  --line-soft: rgba(196, 186, 255, 0.14);
  --accent: #ff9cbc;
  --accent-ink: #ffb8cf;
  --shadow: 0 12px 34px rgba(8, 6, 40, 0.4), 0 2px 6px rgba(8, 6, 40, 0.25);
  --shadow-soft: 0 4px 14px rgba(8, 6, 40, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* ?autotest: fără tranziții (Chrome headless le îngheață la jumătate). */
body.no-anim *, body.no-anim *::before, body.no-anim *::after { transition: none !important; animation: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(180deg, #b9e0ff 0%, #ffe3ec 70%, #fff0d9 100%);
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; }
body.hovering #app canvas { cursor: pointer; }

button { font: inherit; color: inherit; }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 0.45em;
  margin: 0 1px;
  border-radius: 6px;
  background: var(--glass-strong);
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 var(--line-soft);
  font: 600 11px/1.7 var(--font);
  text-align: center;
  color: var(--ink);
}
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.center { text-align: center; }

.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ic.inline { width: 14px; height: 14px; vertical-align: -2px; }

/* Cardul de sticlă, de bază pentru toate panourile. */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: background 1.2s ease, border-color 1.2s ease, color 1.2s ease;
}

/* Interfața apare doar după ce UI-ul e gata. */
#hud, #controls, #panel, #log, #tooltip, #modal { position: fixed; z-index: 10; }

/* ================================================================== încărcarea */

#loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 40% 18% at 20% 72%, rgba(255, 255, 255, 0.9), transparent 70%),
    radial-gradient(ellipse 34% 14% at 78% 80%, rgba(255, 255, 255, 0.85), transparent 70%),
    radial-gradient(ellipse 50% 22% at 50% 98%, rgba(255, 255, 255, 0.95), transparent 70%),
    linear-gradient(180deg, #a6d6ff 0%, #ffd6e4 62%, #ffe8c8 100%);
  color: #5a4466;
  text-align: center;
}
#loading::before,
#loading::after {
  content: '';
  position: absolute;
  width: 340px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%);
  animation: drift 14s ease-in-out infinite alternate;
}
#loading::before { top: 18%; left: 8%; }
#loading::after { top: 30%; right: 6%; animation-duration: 18s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }

.loading-inner { position: relative; z-index: 1; padding: 20px; }
.loading-inner::before {
  content: '';
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cellipse cx='10.5' cy='10' rx='4' ry='4.6' fill='%238a7f86'/%3E%3Cellipse cx='10.5' cy='10.6' rx='2.2' ry='2.8' fill='%23d9a3a0'/%3E%3Cellipse cx='29.5' cy='10' rx='4' ry='4.6' fill='%238a7f86'/%3E%3Cellipse cx='29.5' cy='10.6' rx='2.2' ry='2.8' fill='%23d9a3a0'/%3E%3Cellipse cx='20' cy='19' rx='13' ry='11' fill='%238a7f86'/%3E%3Cellipse cx='20' cy='28' rx='13.5' ry='9' fill='%23ad8f92'/%3E%3Cellipse cx='15' cy='27.5' rx='1.6' ry='2.1' fill='%23504650'/%3E%3Cellipse cx='25' cy='27.5' rx='1.6' ry='2.1' fill='%23504650'/%3E%3Ccircle cx='14' cy='16' r='3' fill='%23fff'/%3E%3Ccircle cx='26' cy='16' r='3' fill='%23fff'/%3E%3Ccircle cx='14.6' cy='16.4' r='1.7' fill='%232d2433'/%3E%3Ccircle cx='26.6' cy='16.4' r='1.7' fill='%232d2433'/%3E%3Ccircle cx='31.5' cy='7.5' r='2.6' fill='%23ffc2d8'/%3E%3Ccircle cx='35' cy='9.5' r='2.6' fill='%23ffb0cc'/%3E%3Ccircle cx='34' cy='13' r='2.6' fill='%23ffc2d8'/%3E%3Ccircle cx='30' cy='12.6' r='2.6' fill='%23ffb0cc'/%3E%3Ccircle cx='29' cy='9' r='2.6' fill='%23ffc2d8'/%3E%3Ccircle cx='32' cy='10.4' r='1.9' fill='%23ffd98a'/%3E%3C/svg%3E");
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(110, 70, 120, 0.2));
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }

.loading-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(240, 120, 158, 0.35), 0 6px 22px rgba(150, 90, 160, 0.35);
}
.loading-msg { margin-top: 8px; font-size: 14px; color: #6d5a7a; }

#loading.has-error .loading-inner::before { animation: none; filter: grayscale(0.4); }
#loading.has-error .loading-msg {
  margin: 14px auto 0;
  max-width: min(760px, 86vw);
  max-height: 50vh;
  overflow: auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: #a83a5e;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  text-align: left;
  white-space: pre-wrap;
  box-shadow: var(--shadow-soft);
}

/* ================================================================== HUD (stânga sus) */

#hud {
  top: var(--gap);
  left: var(--gap);
  width: var(--left-w);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hud-card { padding: 12px 16px 13px; }
.hud-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.brand {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent), var(--peach));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hud-day { font-size: 11px; color: var(--ink-faint); }
.hud-date { margin-top: 2px; font-size: 12.5px; color: var(--ink-soft); }
.hud-time { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.hud-time b { font-size: 31px; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ph-ic {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff1c4, #ffd2a8);
  color: #e0912e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}
.ph-ic .ic { width: 20px; height: 20px; }
body.golden .ph-ic { background: linear-gradient(135deg, #ffd9b8, #ffb5c6); color: #d0617a; }
body.night .ph-ic { background: linear-gradient(135deg, #4c4aa8, #6e5cc4); color: #fff4c6; }
.ph-lbl {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--glass-2);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft);
}
/* Live (§10): eticheta UTC și punctul care pulsează blând. */
.utc { align-self: flex-start; margin: 5px 0 0 -3px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-faint); }
.live-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.08em; color: var(--ink-faint); }
.live-dot { position: relative; display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #ff8fae; }
.live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: livePulse 2.4s ease-out infinite; }
@keyframes livePulse { 0% { transform: scale(1); opacity: 0.6; } 70%, 100% { transform: scale(2.8); opacity: 0; } }

.hud-wx { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.hud-wx > span { display: inline-flex; align-items: center; gap: 4px; }
.hud-wx b { color: var(--ink); font-weight: 600; }
.hud-wx .ic { width: 15px; height: 15px; opacity: 0.8; }
.wx-extra > span { display: inline-flex; align-items: center; gap: 4px; }
.wx-rainbow {
  font-weight: 650;
  background: linear-gradient(90deg, #ff7aa2, #ffb35c, #ffd84f, #6fd3a0, #6db8ff, #a88bf0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wx-rainbow .ic { color: #f0789e; }
.hud-happy { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; }
.hh-ic { color: var(--pink); display: grid; }
.hh-ic .ic { width: 16px; height: 16px; }
.hh-lbl { color: var(--ink-soft); white-space: nowrap; }
.hud-happy b { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.hud-today {
  display: none;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 214, 228, 0.75), rgba(255, 233, 196, 0.75));
  color: #a5476b;
  font-weight: 600;
  font-size: 12px;
}
.hud-today.show { display: flex; }
body.night .hud-today { background: linear-gradient(90deg, rgba(255, 140, 180, 0.25), rgba(255, 200, 120, 0.2)); color: #ffd3e2; }

/* bare blânde */
.bar {
  position: relative;
  flex: 1;
  height: 8px;
  min-width: 40px;
  border-radius: 99px;
  background: var(--line-soft);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--mint);
  transition: width 0.8s ease;
}
.b-mood i { background: linear-gradient(90deg, #ffa3c0, #ffc49a); }
.b-food i { background: linear-gradient(90deg, #b9e68c, #74d3a0); }
.b-rest i { background: linear-gradient(90deg, #c8b6f5, #9d8ae6); }
.b-cool i { background: linear-gradient(90deg, #a6e3f7, #6fbbea); }
.b-social i { background: linear-gradient(90deg, #ffbfd2, #f68fb2); }
.b-fun i { background: linear-gradient(90deg, #ffe08c, #ffb27a); }

/* ================================================================== familia */

.family { padding: 8px 8px 8px; }
.fam-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 6px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.fam-head .ic { width: 16px; height: 16px; }
.fam-hint { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-faint); font-size: 11px; }
.fam-list { display: flex; flex-direction: column; gap: 3px; }
.fam-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 9px 5px 6px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.15s;
}
.fam-card:hover { background: var(--glass-2); transform: translateX(2px); }
.fam-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fam-card.star { background: linear-gradient(100deg, rgba(255, 223, 234, 0.75), rgba(255, 238, 205, 0.55)); border-color: rgba(255, 214, 140, 0.55); }
body.night .fam-card.star { background: linear-gradient(100deg, rgba(255, 140, 180, 0.2), rgba(255, 205, 120, 0.12)); border-color: rgba(255, 214, 140, 0.25); }
.fam-card.selected { background: var(--glass-strong); border-color: var(--accent); box-shadow: var(--shadow-soft); }
.fam-card.following { box-shadow: 0 0 0 2px var(--accent), var(--shadow-soft); }
.fam-av { position: relative; width: 38px; height: 38px; }
.fam-av .avatar { width: 38px; height: 38px; filter: drop-shadow(0 2px 3px rgba(90, 60, 100, 0.18)); }
.fam-main { min-width: 0; display: flex; flex-direction: column; }
.fam-name { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.fam-star { width: 13px; height: 13px; color: var(--gold); }
.fam-age { margin-left: 3px; font-weight: 500; font-size: 11px; color: var(--ink-faint); }
.fam-act { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--ink-soft); }
.fam-ic { display: grid; color: var(--accent-ink); opacity: 0.85; }
.fam-ic .ic { width: 14px; height: 14px; }
.fam-act-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fam-mood { display: grid; transition: color 0.6s; }
.fam-mood .ic { width: 15px; height: 15px; }
.fam-card.m-hi .fam-mood { color: #ff8fb1; }
.fam-card.m-mid .fam-mood { color: #ffbf9c; }
.fam-card.m-lo .fam-mood { color: #c9b8d8; }
.fam-follow {
  position: absolute;
  top: 3px;
  left: 33px;
  display: none;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--glass-strong);
}
.fam-follow .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.fam-card.following .fam-follow { display: grid; }

/* Personajele cu died (Fiona, Henry): ca în lumea 3D, la ~70% opacitate, cu un halou cald și blând. */
.remembered svg.avatar { filter: drop-shadow(0 0 4px rgba(255, 214, 150, 0.85)) drop-shadow(0 0 9px rgba(255, 190, 215, 0.55)); }
/* .fam-card.remembered .fam-ic: fără opacitate redusă (Fiona și Henry sunt opaci, ca în lume) */
body.night .remembered svg.avatar { filter: drop-shadow(0 0 5px rgba(255, 226, 170, 0.7)) drop-shadow(0 0 10px rgba(200, 180, 255, 0.5)); }

/* avatarul: ochii deschiși / închiși */
.avatar .av-shut { display: none; }
.asleep .avatar .av-open { display: none; }
.asleep .avatar .av-shut { display: inline; }

/* ================================================================== controalele (dreapta sus) */

#controls {
  z-index: 13;
  top: var(--gap);
  right: var(--gap);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.ctl-bar { display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 18px; }
.cb, .sp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.cb:hover, .sp:hover { background: var(--glass-2); color: var(--ink); }
.cb.wide { padding: 0 11px 0 9px; font-weight: 600; font-size: 12.5px; }
.cb.on { color: var(--accent-ink); background: var(--glass-2); }
.cb.play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb3c8, #ffc79e);
  color: #fff;
  box-shadow: 0 3px 10px rgba(240, 120, 158, 0.35);
}
.cb.play:hover { color: #fff; filter: brightness(1.05); background: linear-gradient(135deg, #ffb3c8, #ffc79e); }
.cb.play.paused { background: linear-gradient(135deg, #8fdcbf, #8cc8f0); box-shadow: 0 3px 10px rgba(100, 180, 200, 0.4); }
.speeds { display: flex; gap: 2px; padding: 2px; margin-left: 4px; border-radius: 13px; background: var(--line-soft); }
.sp { height: 30px; min-width: 40px; padding: 0 7px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; border-radius: 10px; }
.sp.on { background: var(--glass-strong); color: var(--accent-ink); box-shadow: var(--shadow-soft); }
.sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line-soft); }
.speed-cap {
  margin: 6px 10px 0 0;
  padding: 2px 11px;
  border-radius: 99px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
}
.speed-cap.paused { color: var(--accent-ink); font-weight: 600; }

.pop {
  position: absolute;
  top: 54px;
  right: 0;
  width: 340px;
  max-height: calc(100vh - 90px);
  overflow: auto;
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  background: var(--glass-strong);
  z-index: 12;
}
.pop.open { opacity: 1; visibility: visible; transform: none; }
.pop-title { padding: 2px 6px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.pop-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.pop-item:hover { background: var(--glass-2); }
.pi-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, #fff0d0, #ffd9e4); color: #d0688a; }
body.night .pi-ic { background: linear-gradient(135deg, rgba(120, 100, 220, 0.5), rgba(220, 120, 180, 0.35)); color: #ffe7a8; }
.pi-main { display: flex; flex-direction: column; min-width: 0; }
.pi-main b { font-size: 13px; }
.pi-main span { font-size: 11.5px; color: var(--ink-soft); }
.pi-time { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pop-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--glass-2);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}
.pop-tile .ic { width: 22px; height: 22px; color: var(--accent-ink); }
.pop-tile:hover { background: var(--glass-strong); border-color: var(--accent); }

/* ================================================================== panoul (dreapta) */

#panel {
  top: 98px;
  right: var(--gap);
  bottom: var(--gap);
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateX(24px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background 1.2s ease;
}
body.live #panel { top: 72px; }
#panel.open { opacity: 1; visibility: visible; transform: none; }
.p-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 18px 18px; scrollbar-width: thin; scrollbar-color: var(--line-soft) transparent; }
.p-scroll.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.p-head { display: flex; align-items: center; gap: 12px; }
.p-icon { flex: none; }
.p-avatar { display: block; width: 58px; height: 58px; }
.p-avatar .avatar { width: 58px; height: 58px; filter: drop-shadow(0 3px 5px rgba(90, 60, 100, 0.22)); }
.p-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #d8f5e6, #cde9fb);
  color: #3f9d8a;
}
.p-badge .ic { width: 26px; height: 26px; }
.p-badge.sun, .p-badge.gold { background: linear-gradient(135deg, #fff1c2, #ffd5ae); color: #d88a2a; }
.p-badge.moon { background: linear-gradient(135deg, #d9d4ff, #b9c7f7); color: #6250b8; }
.p-badge.rainbow, .p-badge.cake { background: linear-gradient(135deg, #ffe0ea, #fff0c9); color: #d55d86; }
body.night .p-badge { background: linear-gradient(135deg, rgba(120, 200, 190, 0.3), rgba(120, 160, 240, 0.3)); color: #c8fff0; }
.p-titles { flex: 1; min-width: 0; }
.p-titles h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-size: 21px; font-weight: 780; line-height: 1.2; }
.p-sub { margin-top: 2px; font-size: 12.5px; color: var(--ink-soft); }
.p-sub i { font-style: italic; }
.p-close {
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--glass-2);
  color: var(--ink-soft);
  cursor: pointer;
}
.p-close:hover { background: var(--glass-strong); color: var(--ink); }
.p-years { font-size: 12px; font-weight: 550; color: var(--ink-faint); letter-spacing: 0.02em; }
.quirk {
  margin: 11px 0 0;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 214, 228, 0.45);
  font-size: 12.5px;
  line-height: 1.5;
}
.quirk .bio-tag { color: var(--accent-ink); }
body.night .quirk { background: rgba(255, 150, 190, 0.13); }
.sub-h { margin: 12px 0 6px; font-size: 11px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.habits { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.habits li { padding: 7px 10px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line-soft); font-size: 12.5px; line-height: 1.45; }
.habits li b { display: block; font-size: 12.5px; }
.habits li.now { border-color: var(--accent); }
.badge-star {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px 2px 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #fff0c2, #ffd8e5);
  color: #b4566f;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-star .ic { width: 12px; height: 12px; color: #f1ad2c; }
body.night .badge-star { background: linear-gradient(90deg, rgba(255, 210, 120, 0.3), rgba(255, 150, 190, 0.3)); color: #ffe2ec; }

.p-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: var(--glass-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn .ic { width: 16px; height: 16px; color: var(--accent-ink); }
.btn:hover { background: var(--glass-strong); border-color: var(--accent); }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.on .ic { color: #fff; }
.btn.primary { background: linear-gradient(135deg, #ff9fbd, #ffbe8f); border-color: transparent; color: #fff; padding: 0 18px 0 14px; height: 38px; box-shadow: 0 4px 12px rgba(240, 120, 158, 0.3); }
.btn.primary .ic { color: #fff; }
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; }

.thought {
  position: relative;
  margin: 14px 4px 6px 18px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-size: 13.5px;
  font-style: italic;
  color: var(--ink);
}
.thought::before, .thought::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--glass-strong);
  border: 1px solid var(--line);
}
.thought::before { left: -10px; top: -8px; width: 12px; height: 12px; }
.thought::after { left: -18px; top: -16px; width: 7px; height: 7px; }
.thought span::before { content: '“'; }
.thought span::after { content: '”'; }

.p-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.p-sec h3 { margin: 0 0 9px; font-size: 11px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-faint); }
.p-sec p { margin: 0 0 7px; }
.p-lead { margin: 12px 0 8px; font-size: 13.5px; line-height: 1.55; }
.p-empty { margin: 14px 0; color: var(--ink-soft); }
.is-empty { display: none; }

.now { display: flex; gap: 11px; align-items: flex-start; }
.now-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ffe2ec, #fff0d2);
  color: #d0688a;
}
body.night .now-ic { background: linear-gradient(135deg, rgba(255, 150, 190, 0.28), rgba(255, 210, 130, 0.2)); color: #ffd6e4; }
.now-ic .ic { width: 21px; height: 21px; }
.now-txt { min-width: 0; }
.now-name b { font-size: 14px; }
.bio, .didyou {
  margin: 11px 0 0;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(196, 236, 214, 0.42);
  font-size: 12.5px;
  line-height: 1.5;
}
.didyou { background: rgba(255, 226, 180, 0.4); }
body.night .bio { background: rgba(120, 220, 180, 0.12); }
body.night .didyou { background: rgba(255, 210, 130, 0.12); }
.bio-tag { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: #3c9a7c; }
.didyou .bio-tag { color: #c47c22; }
body.night .bio-tag { color: #8fe8c4; }
body.night .didyou .bio-tag { color: #ffd48a; }
.bio-tag .ic { width: 13px; height: 13px; }

.mood-row { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-weight: 600; }
.mood-row > span[data-v] { min-width: 92px; }
.mood-ic { color: var(--pink); display: grid; }
.mood-ic .ic { width: 16px; height: 16px; }
.needs { display: grid; gap: 6px; }
.need { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }

.comp { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.comp li { display: flex; align-items: center; gap: 8px; }
.comp .ic { color: #3f9d8a; width: 17px; height: 17px; }
.cnt { margin-left: 2px; padding: 0 6px; border-radius: 99px; background: var(--line-soft); font-size: 11px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 9px 7px;
  border-radius: 13px;
  background: var(--glass-2);
  border: 1px solid var(--line-soft);
}
.tile .ic { width: 15px; height: 15px; color: var(--ink-faint); }
.tile b { margin-top: 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 10.5px; line-height: 1.25; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 9px; }
.chip { padding: 2px 10px; border-radius: 99px; background: var(--rose); color: #a24a6a; font-size: 11.5px; font-weight: 600; }
body.night .chip { background: rgba(255, 160, 200, 0.2); color: #ffd0e0; }
.facts { margin: 0 0 9px; padding-left: 18px; }
.facts li { margin-bottom: 4px; }
.facts li::marker { color: var(--accent); }
.dl { display: grid; grid-template-columns: 112px 1fr; gap: 5px 10px; margin: 8px 0 0; font-size: 12.5px; }
.dl dt { color: var(--ink-faint); }
.dl dd { margin: 0; }
.plink { color: var(--accent-ink); font-weight: 650; text-decoration: none; border-bottom: 1px dashed currentColor; cursor: pointer; }
.plink:hover { border-bottom-style: solid; }

.who { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.who li { display: flex; align-items: center; gap: 7px; }
.mini-av { display: inline-block; width: 24px; height: 24px; flex: none; }
.mini-av .avatar { width: 24px; height: 24px; }
.kv { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 12.5px; }
.kv > span:first-child { color: var(--ink-soft); min-width: 120px; }
.kv b { margin-left: auto; text-align: right; }

.laws { display: grid; gap: 9px; margin-top: 14px; }
.law { padding: 11px 13px; border-radius: 16px; background: var(--glass-2); border: 1px solid var(--line-soft); }
.law h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 4px; font-size: 13.5px; }
.law p { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.law .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(116, 211, 174, 0.25); }
.law.off .dot { background: var(--peach); box-shadow: 0 0 0 3px rgba(255, 176, 140, 0.25); }
.law-now { margin-top: 6px !important; padding-top: 6px; border-top: 1px dashed var(--line-soft); color: var(--ink) !important; font-weight: 550; }

.p-laws-link {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin-top: 18px;
  padding: 9px 12px;
  border: 1px dashed var(--line-soft);
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.p-laws-link:hover { background: var(--glass-2); color: var(--accent-ink); }
.p-laws-link .ic { width: 16px; height: 16px; }

/* ================================================================== jurnalul (stânga jos) */

#log {
  left: var(--gap);
  bottom: var(--gap);
  width: var(--left-w);
  padding: 6px 8px 8px;
  border-radius: 18px;
}
.log-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px 6px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
}
.log-head .ic { width: 15px; height: 15px; }
.log-chev { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; opacity: 0.6; }
#log.collapsed .log-chev { transform: rotate(-135deg); }
#log.collapsed .log-list { display: none; }
#log.collapsed .log-head { padding-bottom: 4px; }
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: clamp(62px, calc(100vh - 600px), 236px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 14px), transparent);
  padding-bottom: 12px;
}
.log-list li { display: flex; align-items: flex-start; gap: 7px; padding: 4px 6px; border-radius: 10px; font-size: 12px; line-height: 1.35; }
.log-list li.clickable { cursor: pointer; }
.log-list li.clickable:hover { background: var(--glass-2); }
.log-list li.newest { animation: fadeIn 0.5s ease; }
.log-list li.empty { color: var(--ink-faint); font-style: italic; }
.log-t { flex: none; width: 36px; padding-top: 3px; color: var(--ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.log-list .mini-av { width: 20px; height: 20px; }
.log-list .mini-av .avatar { width: 20px; height: 20px; }
.log-ic { display: grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--accent-ink); }
.log-ic .ic { width: 15px; height: 15px; }
.log-x { min-width: 0; padding-top: 1px; }

/* ================================================================== tooltip, notificări, curiozități */

#tooltip {
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  max-width: 260px;
  padding: 6px 11px;
  border-radius: 12px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
#tooltip.show { opacity: 1; }
#tooltip b { font-size: 13px; }
#tooltip span { font-size: 11.5px; color: var(--ink-soft); }

#toasts {
  position: fixed;
  top: var(--gap);
  left: calc(var(--left-w) + 2 * var(--gap));
  z-index: 20;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 10px;
  border-radius: 18px;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.toast.show { opacity: 1; transform: none; }
.t-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(135deg, #ffe0ea, #fff0c9); color: #d55d86; }
body.night .t-ic { background: linear-gradient(135deg, rgba(255, 150, 190, 0.3), rgba(255, 210, 130, 0.25)); color: #ffe0ea; }
.t-main { display: flex; flex-direction: column; min-width: 0; }
.t-main b { font-size: 13px; }
.t-main span { font-size: 12px; color: var(--ink-soft); }

#fact {
  position: fixed;
  left: 50%;
  bottom: var(--gap);
  z-index: 9;
  display: flex;
  align-items: baseline;
  gap: 9px;
  max-width: min(470px, calc(100vw - 2 * var(--left-w) - 80px));
  padding: 8px 15px;
  border-radius: 16px;
  font-size: 12.5px;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s;
  cursor: pointer;
}
#fact.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.fact-tag { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 10.5px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: #c47c22; }
body.night .fact-tag { color: #ffd48a; }
.fact-tag .ic { width: 13px; height: 13px; }
body.panel-open #fact { left: calc(50% + (var(--left-w) - var(--panel-w)) / 2); }

/* ================================================================== #modal: legenda și bun-venitul */

#modal { inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 20px; }
#modal.open { display: flex; }
.modal-back { position: absolute; inset: 0; background: rgba(90, 60, 110, 0.18); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn 0.3s ease; }
body.night .modal-back { background: rgba(10, 8, 40, 0.4); }
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px 28px 20px;
  border-radius: 28px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(110, 70, 120, 0.28);
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-card.legend { width: min(820px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
.m-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.m-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 21px; }
.m-head h2 .ic { width: 22px; height: 22px; color: var(--accent-ink); }
.m-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lg-stats { margin-right: auto; }

.wl-dedication {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: -4px auto 4px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent-ink);
}
.wl-dedication .ic { width: 14px; height: 14px; color: var(--pink); }
.wl-tribute { margin: 0 auto 14px; max-width: 520px; text-align: center; font-size: 13px; font-style: italic; color: var(--ink-soft); }
.wl-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.wl-av { width: 84px; height: 84px; flex: none; filter: drop-shadow(0 6px 10px rgba(110, 70, 120, 0.25)); animation: bob 3s ease-in-out infinite; }
.wl-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.wl-hero h2 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
.wl-hero p { margin: 4px 0 0; }
.modal-card.welcome > p { font-size: 14px; line-height: 1.6; }
.wl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.wl-grid > div { display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; padding: 12px 13px; border-radius: 16px; background: var(--glass-2); border: 1px solid var(--line-soft); }
.wl-grid .ic { grid-row: span 2; width: 22px; height: 22px; color: var(--accent-ink); }
.wl-grid b { font-size: 13.5px; }
.wl-grid span { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

.lg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.lg-cols h3 { margin: 10px 0 8px; font-size: 11px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-faint); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; align-items: center; }
.keys dt { white-space: nowrap; color: var(--ink-faint); }
.keys dd { margin: 0; font-size: 12.5px; }
.lg-acts { display: flex; flex-wrap: wrap; gap: 5px; }
.lg-act { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 99px; background: var(--glass-2); border: 1px solid var(--line-soft); font-size: 11.5px; }
.lg-act .ic { width: 14px; height: 14px; color: var(--accent-ink); }
.lg-colors { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; font-size: 12px; }
.lg-colors li { display: flex; align-items: center; gap: 7px; }
.sw { width: 26px; height: 8px; border-radius: 99px; flex: none; }
.sw-food { background: linear-gradient(90deg, #b9e68c, #74d3a0); }
.sw-rest { background: linear-gradient(90deg, #c8b6f5, #9d8ae6); }
.sw-cool { background: linear-gradient(90deg, #a6e3f7, #6fbbea); }
.sw-social { background: linear-gradient(90deg, #ffbfd2, #f68fb2); }
.sw-fun { background: linear-gradient(90deg, #ffe08c, #ffb27a); }
.sw-mood { background: linear-gradient(90deg, #ffa3c0, #ffc49a); }
.sw-star { background: linear-gradient(90deg, #fff0c2, #ffd8e5); border: 1px solid #ffd58a; }

/* ================================================================== etichetele 3D (CSS2D) */
/* Atenție: CSS2DRenderer scrie singur `transform` pe fiecare etichetă; aici nu se folosește transform. */

.label-layer { z-index: 5; }
.lbl {
  padding: 2px 9px;
  border-radius: 99px;
  font: 600 12px/1.5 var(--font);
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  background: rgba(78, 56, 98, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  text-shadow: 0 1px 2px rgba(40, 20, 50, 0.3);
  transition: opacity 0.3s;
}
.lbl-hippo {
  padding: 2px 11px;
  font-size: 13px;
  font-weight: 700;
  color: #5a4465;
  background: rgba(255, 252, 253, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 10px rgba(110, 70, 120, 0.18);
  text-shadow: none;
}
.lbl-star {
  color: #a4476a;
  background: linear-gradient(135deg, rgba(255, 246, 220, 0.95), rgba(255, 222, 234, 0.95));
  border-color: #ffd58a;
  box-shadow: 0 3px 12px rgba(240, 160, 90, 0.3);
}
.lbl-star::before { content: '★ '; color: #f1ad2c; }
.lbl-place {
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #4f3f62;
  background: rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.night .lbl { background: rgba(30, 26, 80, 0.45); }
body.night .lbl-hippo { color: #f5f1ff; background: rgba(46, 42, 106, 0.78); border-color: rgba(196, 186, 255, 0.35); }
body.night .lbl-star { color: #ffe3ee; background: linear-gradient(135deg, rgba(120, 80, 150, 0.85), rgba(70, 60, 140, 0.85)); border-color: rgba(255, 213, 138, 0.6); }
body.night .lbl-place { color: #e6e0ff; background: rgba(40, 36, 96, 0.45); text-shadow: none; }

/* ================================================================== ecrane mai mici */

@media (max-width: 1280px) {
  :root { --left-w: 250px; --panel-w: 340px; }
  .cb.wide span { display: none; }
  .cb.wide { padding: 0 8px; }
}

@media (max-height: 700px) {
  .hud-card { padding: 9px 13px 10px; }
  .hud-time b { font-size: 26px; }
  .fam-card { padding-top: 3px; padding-bottom: 3px; }
  .fam-av, .fam-av .avatar { width: 32px; height: 32px; }
  .fam-card { grid-template-columns: 32px 1fr auto; }
  #log .log-list { max-height: clamp(48px, calc(100vh - 540px), 236px); }
}

@media (max-width: 900px) {
  :root { --gap: 10px; --left-w: 230px; }
  .speeds .sp { min-width: 32px; padding: 0 4px; }
  .fam-hint { display: none; }
  .fam-act-t { font-size: 11px; }
  #panel { top: auto; left: var(--gap); width: auto; height: 56vh; border-radius: 22px; transform: translateY(24px); }
  #panel.open { transform: none; }
  body.panel-open #log, body.panel-open .family { display: none; }
  /* Curiozitatea: jos, între jurnal și marginea din dreapta. */
  #fact { left: calc(var(--left-w) + 2 * var(--gap)); right: var(--gap); max-width: none; transform: translateY(8px); }
  #fact.show { transform: none; }
  body.panel-open #fact { display: none; }
  #toasts { left: var(--gap); width: calc(100vw - 2 * var(--gap)); top: auto; bottom: var(--gap); }
  .wl-grid, .lg-cols { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Familia devine un rând de avatare; HUD-ul se strânge. */
  #hud { width: auto; right: calc(var(--gap) + 56px); }
  .hud-card { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; }
  .hud-wx, .hud-happy, .hud-today { grid-column: 1 / -1; }
  .hud-date { display: none; }
  .family { padding: 6px; }
  .fam-head { display: none; }
  .fam-list { flex-direction: row; justify-content: space-between; }
  .fam-card { grid-template-columns: 34px; padding: 3px; }
  .fam-main, .fam-mood { display: none; }
  #controls { top: auto; bottom: var(--gap); right: var(--gap); left: var(--gap); align-items: stretch; }
  .ctl-bar { flex-wrap: wrap; justify-content: center; }
  .speed-cap { display: none; }
  .pop { top: auto; bottom: 58px; width: auto; left: 0; }
  .tiles { grid-template-columns: repeat(2, 1fr); }

  /* HUD-ul pe toată lățimea; faza zilei o spune deja iconița (soare / lună). */
  #hud { right: var(--gap); }
  .hud-card { grid-template-columns: minmax(0, 1fr) auto; }
  .ph-lbl { display: none; }

  /* Jurnalul: foaie jos, peste bara de butoane, strânsă implicit (ui.js); înălțimile vin din _trackLayout(). */
  #log {
    display: block; left: var(--gap); right: var(--gap); width: auto;
    bottom: calc(var(--gap) + var(--ctl-h, 52px) + 8px); padding: 4px 8px 6px;
  }
  #log .log-list { max-height: 34vh; }
  .log-share { width: 32px; height: 32px; margin: -5px -3px -5px auto; }
  .log-share .ic { width: 16px; height: 16px; }

  /* Curiozitatea sub HUD, ca să nu se bată cu jurnalul; bara de reluare peste jurnal. */
  #fact { top: calc(var(--gap) + var(--hud-h, 190px) + 8px); bottom: auto; left: var(--gap); right: var(--gap); transform: translateY(-8px); }
  #timebar { bottom: calc(var(--gap) + var(--ctl-h, 52px) + var(--log-h, 44px) + 16px); }
}

/* ================================================================== istoria jurnalului, distribuirea pe X, reluarea (§11) */

/* Jurnalul: listă derulabilă, cu zilele trecute (ui/journal.js). */
.log-top { display: flex; align-items: center; gap: 4px; }
.log-top .log-head { flex: 1; width: auto; min-width: 0; }
.log-arrival {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 24px; padding: 0 9px 0 7px; margin-right: 2px;
  border: 1px solid var(--line-soft); border-radius: 99px; background: var(--glass-2);
  font-size: 11px; font-weight: 700; color: var(--accent-ink); cursor: pointer;
}
.log-arrival .ic { width: 13px; height: 13px; color: var(--pink); }
.log-arrival:hover { background: var(--glass-strong); border-color: var(--accent); }
#log.collapsed .log-arrival { display: none; }
#log .log-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-soft) transparent;
  max-height: clamp(96px, calc(100vh - 560px), 300px);
}
.log-list li.log-day {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  margin: 4px 0 2px; padding: 3px 6px; border-radius: 8px; background: var(--glass-strong);
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
}
.log-dayn { font-weight: 650; letter-spacing: 0.02em; text-transform: none; color: var(--ink-faint); }
.log-list li.clickable { position: relative; }
.log-list li.big .log-x { font-weight: 600; }
.log-list li.playing { background: linear-gradient(90deg, rgba(255, 176, 200, 0.4), rgba(255, 214, 160, 0.3)); }
/* X pe fiecare moment din jurnal: mereu vizibil; negru când mouse-ul e pe mesaj sau când momentul e cel redat. */
.log-share {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; margin: -3px -3px -3px auto; padding: 0;
  border: 1px solid rgba(29, 27, 34, 0.16); border-radius: 8px; background: var(--glass-strong); color: #1d1b22; cursor: pointer;
  box-shadow: 0 1px 3px rgba(29, 27, 34, 0.12); transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.log-share .ic { width: 15px; height: 15px; }
.log-list li:hover .log-share, .log-list li.playing .log-share, .log-share:focus-visible {
  background: #1d1b22; border-color: #1d1b22; color: #fff;
}
.log-share:hover { transform: scale(1.08); }
.log-list li.log-more, .log-list li.log-end, .log-list li.log-loading { justify-content: center; padding: 6px 4px 2px; font-size: 11.5px; color: var(--ink-faint); }
.log-list li.log-loading .ic, .log-list li.log-end .ic { width: 13px; height: 13px; color: var(--pink); }
.log-list li.log-loading span { font-style: italic; }
.log-list li.log-end { text-align: center; font-style: italic; }
.log-more button {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 12px 0 9px; border: 1px solid var(--line-soft); border-radius: 99px;
  background: var(--glass-2); font-size: 11.5px; font-weight: 650; color: var(--ink-soft); cursor: pointer;
}
.log-more button .ic { width: 13px; height: 13px; }
.log-more button:hover { background: var(--glass-strong); border-color: var(--accent); color: var(--ink); }

/* X pe gândul hipopotamului și pe legi (ui/panel.js). */
.thought { padding-right: 46px; }
.th-share, .law-share {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
  border: 1px solid rgba(29, 27, 34, 0.16); border-radius: 10px; background: var(--glass-strong); color: #1d1b22; cursor: pointer;
  box-shadow: 0 1px 3px rgba(29, 27, 34, 0.12); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.th-share { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); }
.th-share .ic, .law-share .ic { width: 17px; height: 17px; }
.th-share:hover, .thought:hover .th-share, .law-share:hover, .law:hover .law-share, .law.focus .law-share {
  background: #1d1b22; border-color: #1d1b22; color: #fff;
}
.law h4 .law-name { flex: 1; }
.law-share { width: 30px; height: 30px; }
.law.focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 120, 158, 0.18); animation: lawGlow 2.4s ease 2; }
@keyframes lawGlow { 50% { box-shadow: 0 0 0 6px rgba(240, 120, 158, 0.28); } }

/* Curiozitatea: stă mai mult și se poate distribui. */
#fact { align-items: center; cursor: default; padding-right: 8px; }
.fact-x { flex: 1; }
.fact-btn {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-faint); cursor: pointer;
}
.fact-btn .ic { width: 13px; height: 13px; }
.fact-btn:hover { background: var(--glass-strong); color: var(--ink); }
.fact-btn[data-f="share"] {
  width: 30px; height: 30px; border: 1px solid rgba(29, 27, 34, 0.16); background: var(--glass-strong); color: #1d1b22;
  box-shadow: 0 1px 3px rgba(29, 27, 34, 0.12);
}
.fact-btn[data-f="share"] .ic { width: 16px; height: 16px; }
.fact-btn[data-f="share"]:hover, #fact:hover .fact-btn[data-f="share"] { background: #1d1b22; border-color: #1d1b22; color: #fff; }

/* Eticheta din HUD în reluare. */
.live-badge.replay { color: var(--accent-ink); }
.live-badge.replay .live-dot { background: var(--peach); }
.live-badge.replay .live-dot::after { animation: none; }

/* Bara de reluare (jos, la mijloc; ui/timebar.js). */
#timebar {
  position: fixed; left: 50%; bottom: var(--gap); z-index: 11; width: min(560px, calc(100vw - 2 * var(--left-w) - 80px));
  padding: 10px 14px 10px; border-radius: 20px; opacity: 0; visibility: hidden; transform: translate(-50%, 10px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s, background 1.2s ease;
}
#timebar.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
body.panel-open #timebar { left: calc(50% + (var(--left-w) - var(--panel-w)) / 2); }
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 7px; border-radius: 99px;
  background: linear-gradient(135deg, #ffd9e6, #ffe7c7); color: #b8466c; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
body.night .tb-badge { background: linear-gradient(135deg, rgba(255, 150, 190, 0.3), rgba(255, 210, 130, 0.22)); color: #ffd6e4; }
.tb-badge .ic { width: 14px; height: 14px; }
#timebar.ff .tb-badge .ic { animation: spinBack 1.4s linear infinite; }
@keyframes spinBack { to { transform: rotate(-360deg); } }
.tb-when { display: inline-flex; align-items: baseline; gap: 7px; min-width: 0; }
.tb-when b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tb-when span { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-behind { margin-left: auto; font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.tb-moment { display: none; margin: 6px 0 0; font-size: 12.5px; font-style: italic; color: var(--ink); line-height: 1.4; }
.tb-moment.on { display: block; }
.tb-ctl { display: flex; align-items: center; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.tb-lbl { margin-right: 2px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.tb-sp, .tb-live {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 8px; border: 1px solid var(--line-soft); border-radius: 99px;
  background: var(--glass-2); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.tb-sp .ic { width: 12px; height: 12px; color: var(--accent-ink); }
.tb-sp:hover, .tb-live:hover { background: var(--glass-strong); border-color: var(--accent); }
.tb-sp.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-sp.on .ic { color: #fff; }
.tb-live { margin-left: auto; padding: 0 13px 0 11px; background: linear-gradient(135deg, #ff9fbd, #ffbe8f); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(240, 120, 158, 0.28); }
.tb-live .live-dot { background: #fff; }
.tb-live:hover { filter: brightness(1.05); border-color: transparent; background: linear-gradient(135deg, #ff9fbd, #ffbe8f); }
.tb-prog { display: none; height: 4px; margin-top: 9px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
#timebar.ff .tb-prog { display: block; }
.tb-prog i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--peach)); transition: width 0.25s linear; }

/* Vălul cât se reconstruiește lumea la alt moment (≤ ~1 s). */
#veil {
  position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 50% 55%, rgba(255, 255, 255, 0.55), transparent 70%), linear-gradient(180deg, rgba(186, 222, 255, 0.82), rgba(255, 220, 232, 0.86) 62%, rgba(255, 236, 210, 0.88));
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s;
}
#veil.show { opacity: 1; visibility: visible; pointer-events: auto; }
.veil-in { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #5a4466; text-align: center; }
.veil-in > .ic { width: 34px; height: 34px; color: #d0688a; animation: spinBack 1.6s linear infinite; }
.veil-in b { font-size: 18px; }
.veil-in span { font-size: 13px; color: #7a6c86; }
.veil-bar { width: 220px; height: 5px; margin-top: 6px; border-radius: 99px; background: rgba(120, 90, 140, 0.15); overflow: hidden; }
.veil-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f792b4, #ffb08c); }

@media (max-width: 900px) {
  #timebar { left: 50%; width: calc(100vw - 2 * var(--gap)); bottom: calc(var(--gap) + 64px); }
  body.panel-open #timebar { left: 50%; }
  .tb-lbl { display: none; }
}
@media (max-width: 640px) {
  .tb-sp span { font-size: 11px; }
  .tb-sp { padding: 0 7px 0 6px; }
}
