/* Hai màu được tick trên bảng màu:
   nền xanh nhạt #91BAD9, nút và chữ xanh đậm #1E3F66.
   Cây thông vẫn xanh lá để trông ra cây. */
:root {
  --bg: #91bad9;
  --paper: #f4f9fc;
  --ink: #1e3f66;
  --muted: #3d6278;
  --line: #7aabc8;
  --red: #1e3f66;
  --red-dark: #152c45;
  --green: #1f6b40;
  --gold: #b8893a;
  --dot: rgba(30, 63, 102, 0.16);
  --serif: Georgia, "Palatino Linotype", Palatino, serif;
  --sans: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.1px);
  background-size: 20px 20px;
  font-family: var(--sans);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.logo, .logo-btn {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: 34px; margin: 0 0 12px; }
h2 { font-size: 28px; margin: 12px 0; }
h3 { font-size: 20px; margin: 16px 0 6px; }
p { margin: 0 0 8px; }

button, input, textarea { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  padding: 8px 14px;
}

button.primary {
  background: var(--red);
  color: white;
  border-color: var(--red-dark);
}

button.primary:hover { background: var(--red-dark); }

button:disabled { opacity: 0.6; cursor: default; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

button.text-btn {
  background: transparent;
  border: 0;
  color: var(--red);
  padding: 0;
  border-radius: 0;
  text-decoration: underline;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

select { margin-bottom: 10px; }

textarea { min-height: 90px; resize: vertical; }

label, .section-head p { color: var(--ink); }

.muted { color: var(--muted); }
.hidden { display: none !important; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.card.warn { background: #e7f3fa; border-color: #91bad9; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 14px 0;
}

.check-row input { width: 18px; height: 18px; }

.auth-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 64px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

.logo { font-size: 42px; margin: 0 0 8px; }
.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li { margin: 6px 0; }
.auth-card h2 { margin-top: 0; }

.shell { max-width: 920px; margin: 0 auto; padding: 20px 16px 48px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.logo-btn {
  border: 0;
  background: transparent;
  font-size: 32px;
  padding: 0;
  border-radius: 0;
}

.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#me-name { font-weight: 700; }

#looking-btn.on {
  background: var(--red);
  border-color: var(--red-dark);
  color: white;
}

nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 18px; }

nav button {
  background: transparent;
  border-color: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
}

nav button.active {
  color: var(--ink);
  border-bottom-color: var(--red);
}

.formula { border-left: 4px solid var(--red); }
.formula ul, .math { margin: 8px 0; padding-left: 18px; }
.math { color: var(--muted); font-size: 14px; }

.person-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }

.score {
  width: 68px;
  height: 68px;
  flex: none;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  font-family: var(--sans);
}

.score b { font-size: 22px; line-height: 1; }
.score span { font-size: 11px; }

.banner {
  background: #d7eaf5;
  border: 1px solid #91bad9;
  padding: 12px;
  border-radius: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.banner p { margin: 0; flex: 1; }

.trait, .chip, .emo {
  display: inline-block;
  margin: 0 6px 6px 0;
  border-radius: 999px;
}

.trait, .chip {
  padding: 3px 10px;
  font-size: 14px;
}

.chip {
  background: #e7f3fa;
  border: 1px solid var(--line);
}

.trait {
  background: var(--c, #1e3f66);
  color: white;
  border: 1px solid transparent;
}

.emo {
  background: var(--c, white);
  color: white;
  border: 2px solid transparent;
  font-weight: 700;
}

.emo.on {
  box-shadow: 0 0 0 3px #f4f9fc, 0 0 0 6px var(--c);
}
.emo-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.chat-log {
  height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}

.bubble p { white-space: pre-wrap; margin: 0; }
.bubble.mine { margin-left: auto; background: #d7eaf5; border-color: #91bad9; }
.who, .time { display: block; font-size: 12px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

button.tree-card {
  font: inherit;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  border-radius: 16px;
  padding: 14px;
  background: var(--paper);
}

button.tree-card strong,
button.tree-card .muted,
button.tree-card .preview { display: block; }
.preview { color: var(--muted); font-size: 13px; }

.mini-tree {
  width: 46px;
  height: 56px;
  flex: none;
  background: var(--green);
  clip-path: polygon(50% 0, 100% 76%, 78% 76%, 78% 100%, 22% 100%, 22% 76%, 0 76%);
}

.tree-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}

.tree-stage {
  position: relative;
  width: min(340px, 100%);
  height: 510px;
  margin: 8px auto 0;
  background: var(--red);
  border-radius: 28px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.star {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 30px;
  line-height: 1;
}

.layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.l1 { top: 50px; width: 150px; height: 130px; background: #3c9460; }
.l2 { top: 136px; width: 230px; height: 160px; background: #2b7a4d; }
.l3 { top: 236px; width: 310px; height: 190px; background: #1d613c; }

.trunk {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 34px;
  height: 54px;
  transform: translateX(-50%);
  background: #7a4e32;
  border-radius: 3px;
}

#bauble-layer,
#mine-layer { position: absolute; inset: 0; }

.bauble {
  position: absolute;
  z-index: 4;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
  color: white;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.15);
}

.bauble::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 8px;
  height: 7px;
  transform: translateX(-50%);
  background: var(--gold);
  border-radius: 2px 2px 0 0;
}

button.bauble { cursor: pointer; }
button.bauble.selected { outline: 3px solid var(--gold); outline-offset: 2px; }

#bauble-read { margin-top: 12px; }
#bauble-read p { white-space: pre-wrap; }
.notes { margin: 0; padding-left: 18px; }

.recap-panel {
  margin-top: 28px;
  background: var(--red);
  color: white;
  border-radius: 22px;
  padding: 16px 18px 8px;
}

.recap-panel h2,
.recap-panel p { color: white; }

.recap-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.recap-panel input[type="month"] {
  width: auto;
  background: #152c45;
  color: white;
  border-color: transparent;
}

.bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 24px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.bar-track {
  height: 14px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill { display: block; height: 100%; border-radius: 999px; min-width: 0; }

.recap-summary { margin-top: 12px; }

.recap-list { list-style: none; margin: 8px 0 12px; padding: 0; }

.recap-list li { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }

.dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  flex: none;
}

.recap-hint { color: rgba(255, 255, 255, 0.72); }
.notes li { margin: 8px 0; }

.foot { color: var(--muted); font-size: 14px; margin-top: 28px; }

.toast {
  position: fixed;
  z-index: 20;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
  max-width: min(520px, calc(100% - 24px));
}

@media (max-width: 720px) {
  h1 { font-size: 28px; }
  .auth-wrap, .tree-layout { grid-template-columns: 1fr; }
  .hero-tree { display: none; }
  .chat-log { height: 280px; }
}
