/* Cây Tri Thức FTEL 30 năm – giao diện Phase 2 (tối, phong cách công nghệ, màu logo FPT Telecom) */
:root {
  --bg: #050b1a;
  --bg2: #0a1630;
  --card: rgba(13, 28, 58, 0.72);
  --line: rgba(79, 157, 255, 0.18);
  --text: #e8eefc;
  --muted: #93a4c8;
  --orange: #f37021;
  --blue: #0b6fd0;
  --sky: #4fc3ff;
  --green: #45b649;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(11, 111, 208, 0.28), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(243, 112, 33, 0.14), transparent 60%), var(--bg);
  min-height: 100vh;
  line-height: 1.55;
}
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 75%);
  opacity: 0.45;
}
header, main, footer { position: relative; z-index: 1; }

/* Đầu trang */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 4vw, 48px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-flex; gap: 4px; transform: skewX(-12deg); }
.brand-mark i { display: block; width: 10px; height: 26px; border-radius: 3px; }
.brand-mark .o { background: var(--orange); } .brand-mark .b { background: var(--blue); } .brand-mark .g { background: var(--green); }
.brand-title { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.brand-title b { color: var(--orange); }
.brand-sub { font-size: 12px; color: var(--muted); }
.btn-tree {
  font: inherit; font-weight: 700; color: #fff; cursor: pointer; border: 0; border-radius: 999px; padding: 10px 18px;
  background: linear-gradient(135deg, var(--orange), #ff9a4d); box-shadow: 0 6px 24px rgba(243, 112, 33, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-tree { white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.btn-theme { width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1;
  background: var(--card); border: 1px solid var(--line); transition: transform 0.15s ease, border-color 0.15s ease; }
.btn-theme:hover { transform: translateY(-1px); border-color: var(--orange); }
.btn-tree:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(243, 112, 33, 0.45); }

main { padding: 0 clamp(16px, 4vw, 48px) 40px; max-width: 1240px; margin: 0 auto; }

/* Phần mở đầu */
.hero { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 32px; align-items: center; padding: 24px 0 8px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--sky); }
.hero h1 { margin: 0 0 12px; font-size: clamp(28px, 4.2vw, 46px); line-height: 1.15; font-weight: 800;
  background: linear-gradient(90deg, #fff, #cfe3ff 55%, #ffd2b5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 0; color: #c3d0ec; font-size: 16px; max-width: 560px; }
.lead b { color: #fff; }

.how { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.how b { color: var(--text); }

/* Khung Cây Tri Thức (hiện ngay trên trang, phóng to được) – luôn nền tối để cây phát sáng nổi bật */
.tree-panel {
  --text: #e8eefc; --muted: #93a4c8; --line: rgba(79, 157, 255, 0.18); --sky: #4fc3ff;
  position: relative; color: var(--text); display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(600px 420px at 50% 40%, rgba(11, 111, 208, 0.25), transparent 70%), #060e22;
  border: 1px solid rgba(79, 195, 255, 0.3); border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.tree-panel .scene { height: 440px; }
.tree-info { padding: 16px 20px 18px; border-top: 1px solid var(--line); background: rgba(5, 11, 26, 0.55); }
.tree-close { display: none; position: absolute; top: 12px; right: 12px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(5, 11, 26, 0.85); color: #fff; font-size: 16px; cursor: pointer; }
.tree-close:hover { border-color: var(--orange); }
/* Toàn màn hình */
.tree-panel.is-full { position: fixed; inset: 0; z-index: 50; border-radius: 0; border: 0; display: grid; grid-template-columns: 1.6fr 1fr; }
.tree-panel.is-full .scene { height: 100%; }
.tree-panel.is-full .tree-info { border-top: 0; border-left: 1px solid var(--line); padding: 34px 28px; display: flex; flex-direction: column; justify-content: center; }
.tree-panel.is-full .stage-name { font-size: 32px; }
.tree-panel.is-full .tree-close { display: block; }

.stage-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 13px; }
.stage-exp b { color: #fff; font-size: 18px; }
.stage-name { font-size: 24px; font-weight: 800; margin: 2px 0 10px; }
.progress { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--sky) 45%, var(--green) 75%, var(--orange)); transition: width 0.8s ease; }
.stage-next { margin-top: 8px; font-size: 13px; color: #c3d0ec; }

/* Số liệu */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0 28px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-num { display: block; font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); }

/* Kho Tàng */
.treasury-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.treasury h2 { margin: 0; font-size: 22px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.search input { background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; width: min(280px, 60vw); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.chip.active { color: #fff; border-color: var(--orange); background: rgba(243, 112, 33, 0.15); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.quote {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 14px;
  display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
.quote::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.quote.p2::before { background: linear-gradient(var(--orange), var(--green)); }
.quote.fresh { animation: fresh 1.6s ease; }
@keyframes fresh { 0% { box-shadow: 0 0 0 0 rgba(243, 112, 33, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(243, 112, 33, 0); } }
.quote blockquote { margin: 0; font-size: 15.5px; line-height: 1.6; color: #f3f6ff; }
.quote blockquote::before { content: '“'; color: var(--orange); font-size: 26px; line-height: 0; vertical-align: -8px; margin-right: 2px; }
.quote .note { margin: 0; font-size: 13px; color: var(--muted); font-style: italic; }
.quote .book { font-size: 13px; color: #cfe3ff; }
.quote .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 6px; border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.quote .pen { color: #fff; font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.badge.p2 { color: #ffd2b5; background: rgba(243, 112, 33, 0.16); }
.badge.p1 { color: #b9d7ff; background: rgba(11, 111, 208, 0.18); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.more-wrap { text-align: center; margin-top: 18px; }
.btn-more { font: inherit; cursor: pointer; color: #fff; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 999px; padding: 9px 22px; }
.btn-more:hover { border-color: var(--sky); }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 32px; }

.scene { position: relative; min-height: 300px; }
.scene canvas { display: block; width: 100%; height: 100%; }
.scene-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.m-hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
/* Thả tim */
.quote .meta-r { display: inline-flex; align-items: center; gap: 8px; }
.heart { font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: transform 0.12s ease, color 0.12s ease, border-color 0.12s ease; }
.heart:hover:not(:disabled) { color: #ff5a7a; border-color: rgba(255, 90, 122, 0.6); transform: scale(1.06); }
.heart.on { color: #ff5a7a; border-color: rgba(255, 90, 122, 0.55); background: rgba(255, 90, 122, 0.1); }
.heart:disabled { opacity: 0.45; cursor: not-allowed; }
.heart-who { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.heart-who b { color: var(--text); }
.link-btn { font: inherit; color: var(--sky); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
/* Phim quay sẵn của cây (máy không chạy được 3D) */
.scene-video { display: block; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.m-preview { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.m-preview-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.m-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } /* 6 giai đoạn: 2 hàng × 3 */
.m-stage { font: inherit; font-size: 11px; line-height: 1.25; cursor: pointer; color: var(--muted); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 4px; text-align: center; }
.m-stage b { display: block; font-size: 15px; color: #fff; }
.m-stage:hover { border-color: var(--sky); }
.m-stage.done { color: #b9e6bb; }
.m-stage.now { border-color: rgba(69, 182, 73, 0.7); color: #fff; }
.m-stage.active { color: #fff; border-color: var(--orange); background: rgba(243, 112, 33, 0.16); box-shadow: 0 0 12px rgba(243, 112, 33, 0.3); }
.m-preview-note { margin: 10px 0 0; font-size: 13px; color: #ffd2b5; }
.m-preview-note button { font: inherit; font-size: 12px; cursor: pointer; color: #fff; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin-left: 6px; }
.m-preview-note button:hover { border-color: var(--sky); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px);
  background: rgba(10, 22, 48, 0.95); border: 1px solid rgba(243, 112, 33, 0.5); border-radius: 14px; padding: 10px 16px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }

/* Gửi quote từ trang web */
.btn-write { font: inherit; font-weight: 700; color: var(--text); cursor: pointer; white-space: nowrap; border-radius: 999px; padding: 9px 16px;
  background: var(--card); border: 1px solid rgba(243, 112, 33, 0.6); transition: transform 0.15s ease, border-color 0.15s ease; }
.btn-write:hover { transform: translateY(-1px); border-color: var(--orange); }
.qd { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); background: var(--bg2); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.qd::backdrop { background: rgba(3, 8, 20, 0.62); backdrop-filter: blur(3px); }
.qd-form { padding: 20px 22px 18px; }
.qd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qd-head h2 { margin: 0; font-size: 20px; }
.qd-x { font: inherit; font-size: 16px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid var(--line); }
.qd-x:hover { color: var(--text); border-color: var(--orange); }
.qd-sub { margin: 6px 0 14px; font-size: 14px; color: var(--muted); }
.qd-sub b { color: var(--text); }
.qd-field { display: block; margin-top: 10px; }
.qd-field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.qd-field i { color: var(--orange); font-style: normal; }
.qd-field input, .qd-field textarea { width: 100%; font: inherit; font-size: 15px; color: var(--text); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.qd-field textarea { resize: vertical; min-height: 96px; }
.qd-field input:focus, .qd-field textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(79, 195, 255, 0.15); }
.qd-hint { margin: 5px 0 0; min-height: 18px; font-size: 12.5px; color: var(--muted); }
.qd-hint.ok { color: var(--green); }
.qd-hint.new { color: var(--sky); }
.qd-hint.bad { color: #ff8a65; }
.qd-hint b { color: var(--text); }
.qd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qd-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.qd-msg { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.qd-msg.ok { border-color: rgba(69, 182, 73, 0.6); background: rgba(69, 182, 73, 0.1); }
.qd-msg.bad { border-color: rgba(255, 138, 101, 0.6); background: rgba(255, 138, 101, 0.1); }
.qd-msg.wait { border-color: rgba(79, 195, 255, 0.5); }
.qd-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.qd-actions .btn-tree:disabled { opacity: 0.6; cursor: wait; transform: none; }
.qd-later { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0; }
.qd-later:hover { color: var(--text); }
.badge.web { color: #b9f0bb; background: rgba(69, 182, 73, 0.16); }
html.light .qd { --line: rgba(11, 111, 208, 0.2); background: #fff; color: #0f1b33; box-shadow: 0 30px 80px rgba(15, 27, 51, 0.25); }
html.light .qd::backdrop { background: rgba(15, 27, 51, 0.35); }
html.light .qd-field input, html.light .qd-field textarea { background: #f6f8fc; color: #0f1b33; }
html.light .qd-hint.ok { color: #2e8b31; }
html.light .qd-hint.new { color: #0b6fd0; }
html.light .qd-hint.bad { color: #c2410c; }
html.light .badge.web { color: #2e7d32; background: rgba(69, 182, 73, 0.12); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .tree-panel .scene { height: 380px; }
  .tree-panel.is-full { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .tree-panel.is-full .tree-info { border-left: 0; border-top: 1px solid var(--line); padding: 16px 18px 20px; }
  .tree-panel.is-full .stage-name { font-size: 24px; }
}
@media (max-width: 520px) {
  .top { padding: 14px 16px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 16px; }
  .btn-tree .long { display: none; }
  .btn-tree { padding: 9px 14px; font-size: 14px; }
  .btn-write { padding: 8px 12px; font-size: 14px; }
  .btn-write .long { display: none; }
  .top-actions { gap: 6px; }
  .qd-form { padding: 16px 16px 14px; }
  .qd-row { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; }
  .stat-num { font-size: 20px; }
  .m-stage { font-size: 10px; padding: 6px 2px; }
}
@media (max-width: 430px) {
  /* đầu trang điện thoại: tên + 3 nút trên 1 dòng */
  #open-tree .txt { display: none; }
  #open-tree { padding: 9px 13px; }
  .brand { gap: 8px; }
  .brand-mark i { width: 8px; height: 22px; }
}
/* Giao diện SÁNG (6h–18h giờ Việt Nam hoặc người dùng chọn) – cửa sổ cây 3D giữ nền tối để cây phát sáng nổi bật */
html.light body {
  --bg: #f3f6fb; --card: rgba(255, 255, 255, 0.92); --line: rgba(11, 111, 208, 0.16); --text: #0f1b33; --muted: #5b6b88; --sky: #0b6fd0;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(11, 111, 208, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(243, 112, 33, 0.1), transparent 60%), var(--bg);
}
html.light .bg-grid { opacity: 0.3; }
html.light .hero h1 { background: linear-gradient(90deg, #0b2a5c, #0b6fd0 55%, #f37021); -webkit-background-clip: text; background-clip: text; }
html.light .lead { color: #3b4a66; }
html.light .lead b, html.light .chip.active, html.light .quote .pen, html.light .btn-more { color: #0f1b33; }
html.light .tree-panel { box-shadow: 0 18px 40px rgba(15, 27, 51, 0.18); }
html.light .stat, html.light .quote { box-shadow: 0 4px 14px rgba(15, 27, 51, 0.05); }
html.light .progress { background: rgba(15, 27, 51, 0.08); }
html.light .search, html.light .btn-more { background: #fff; }
html.light .quote blockquote { color: #13213d; }
html.light .quote .book { color: #0b5cad; }
html.light .quote .meta { border-top-color: rgba(15, 27, 51, 0.1); }
html.light .badge.p2 { color: #b4480f; background: rgba(243, 112, 33, 0.12); }
html.light .badge.p1 { color: #0b5cad; background: rgba(11, 111, 208, 0.1); }
html.light .toast { background: #fff; color: #0f1b33; box-shadow: 0 10px 30px rgba(15, 27, 51, 0.15); }
html.light .tree-panel { --text: #e8eefc; --muted: #93a4c8; --line: rgba(79, 157, 255, 0.18); --sky: #4fc3ff; color: var(--text); }
html.light .tree-panel .progress { background: rgba(255, 255, 255, 0.08); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Thanh điều hướng chính (BTC 03/11/2026): Vườn Tri Thức | Trạm Kết Nối – dùng chung trang chủ và diễn đàn */
.site-nav { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 999px; white-space: nowrap; text-align: center; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active { color: #fff; background: linear-gradient(135deg, var(--blue), #1aa3e8); }
html.light .site-nav { background: #fff; }
html.light .site-nav a.active { color: #fff; }
@media (max-width: 900px) {
  /* hàng 1: tên + các nút như trước; hàng 2: thanh điều hướng */
  .top { flex-wrap: wrap; row-gap: 10px; }
  .top > .brand { flex: 1 1 0; min-width: 0; }
  .top > .top-actions { flex: none; }
  .site-nav { order: 3; flex: 1 1 100%; }
  .site-nav a { flex: 1; }
}
@media (max-width: 430px) {
  .site-nav a { font-size: 12.5px; padding: 7px 4px; }
}
