:root {
  --text: #f4f6ff;
  --muted: rgba(235, 240, 255, .72);
  --accent: #b4c0ff;
  --accent2: #8fd6ff;
  --glass: rgba(18, 24, 60, .38);
  --glass-line: rgba(200, 215, 255, .22);
  --tint: 150,170,255;
  --glow: 90,110,255;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Quicksand", "Segoe UI", Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans); color: var(--text);
  min-height: 100vh; background: #080c1e;
  animation: pageIn .7s ease both;
}
body.home { overflow: hidden; height: 100vh; }
body.leaving { opacity: 0; transition: opacity .3s ease; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
a { color: inherit; text-decoration: none; }

/* ---------- Nền ---------- */
#bg-video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; }
.overlay {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(10,14,50,.55), transparent 60%),
    linear-gradient(to bottom, rgba(5,8,30,.45), rgba(5,8,30,.1) 35%, rgba(5,8,30,.5));
}
body:not(.home) .overlay { background: linear-gradient(rgba(5,8,30,.62), rgba(5,8,30,.55)); backdrop-filter: blur(3px); }
#sparkles { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* ---------- Kính mờ ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 20px;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
}

/* ---------- Thanh trên ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: 84px; padding: 0 4vw;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: linear-gradient(rgba(4,6,24,.55), transparent);
}
.logo {
  font-family: var(--serif); font-weight: 600; font-size: 2rem;
  letter-spacing: .28em; justify-self: start; margin-left: 2vw;
  text-shadow: 0 0 18px rgba(var(--tint),.7);
}
.nav { display: flex; gap: 2.6rem; }
.nav a {
  position: relative; padding: .4rem 0;
  font-size: 1rem; font-weight: 500; letter-spacing: .08em; opacity: .85;
  transition: opacity .25s;
}
.nav a::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; width: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px; box-shadow: 0 0 10px var(--accent);
  transition: width .3s, left .3s;
}
.nav a:hover, .nav a.active { opacity: 1; }
.nav a:hover::after, .nav a.active::after { width: 100%; left: 0; }

.mini {
  justify-self: end; display: flex; align-items: center; gap: .7rem;
  padding: .55rem .9rem .55rem .6rem; border-radius: 999px; font-size: .85rem;
}
.mini .dot-av { position: relative; transition: box-shadow .4s; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #2b3470; display: grid; place-items: center; font-weight: 600; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini b { display: block; font-weight: 600; line-height: 1.1; }
.mini.clickable { cursor: pointer; transition: transform .25s, border-color .25s, box-shadow .25s; }
.mini.clickable:hover { transform: translateY(-2px); border-color: rgba(var(--tint),.65); box-shadow: 0 8px 30px rgba(var(--glow),.4); }
.mini .mini-text { min-width: 0; }
.mini small { display: block; color: var(--muted); font-size: .72rem; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .on { width: 9px; height: 9px; border-radius: 50%; background: #5ee68b; box-shadow: 0 0 8px #5ee68b; }

/* ---------- Trang chủ ---------- */
.home main.home, main.home {
  position: fixed; top: 21vh; left: 8vw; width: min(480px, 84vw);
  text-align: center; text-shadow: 0 2px 18px rgba(0,0,0,.5);
  animation: fadeUp 1s .2s both;
}
.qmark {
  display: block; font-family: var(--serif); font-size: 6rem; line-height: .6; height: 3rem;
  color: var(--accent); opacity: .65; text-shadow: 0 0 30px var(--accent);
}
#quote {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.9rem, 3vw, 2.7rem); line-height: 1.25; letter-spacing: .01em;
  cursor: pointer; min-height: 3.4em; display: flex; align-items: center; justify-content: center;
  transition: opacity .6s ease, transform .6s ease;
}
#author { margin-top: .6rem; font-size: 1rem; letter-spacing: .12em; color: var(--accent); transition: opacity .6s; min-height: 1.4em; }
#quote.fade, #author.fade { opacity: 0; }
#quote.fade { transform: translateY(8px); }

.menu { list-style: none; margin-top: 2.4rem; }
.menu li { margin: 1.2rem 0; }
.menu a {
  position: relative; display: inline-block; padding: .2rem .3rem;
  font-family: var(--serif); font-size: 1.7rem; letter-spacing: .08em;
  transition: transform .25s, text-shadow .25s;
}
.menu a::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 0; height: 1px;
  background: var(--accent); transition: width .3s, left .3s;
}
.menu a:hover { transform: translateY(-2px); text-shadow: 0 0 16px var(--accent); }
.menu a:hover::after { width: 100%; left: 0; }

/* ---------- Trang phụ ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 130px 24px 90px; }
.title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.6rem, 5vw, 3.8rem);
  letter-spacing: .06em; margin-bottom: 2rem; text-shadow: 0 0 24px rgba(var(--tint),.5);
}
.title small {
  display: block; font-family: var(--sans); font-size: .85rem; font-weight: 500;
  letter-spacing: .35em; text-transform: uppercase; color: var(--accent); margin-top: .3rem;
}
.reveal { animation: fadeUp .8s var(--d, 0s) both; }

/* Giới thiệu */
.about { display: grid; grid-template-columns: 220px 1fr; gap: 2.4rem; padding: 2.4rem; }
.avatar-wrap {
  width: 200px; height: 200px; border-radius: 50%; padding: 4px; align-self: start;
  background: conic-gradient(from 0deg, var(--accent), var(--accent2), #d6a8ff, var(--accent));
  box-shadow: 0 0 40px rgba(var(--tint),.45);
  animation: spin 14s linear infinite;
}
.avatar-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #1b2150; animation: spin 14s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.about-body h3 { font-family: var(--serif); font-size: 2.4rem; font-weight: 600; letter-spacing: .04em; }
.tagline { color: var(--accent); letter-spacing: .12em; margin: .2rem 0 1.2rem; }
#bio p { line-height: 1.8; color: var(--muted); margin-bottom: .8rem; }
.info { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem 1.6rem; margin: 1.4rem 0; }
.info div { padding: .7rem 1rem; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.info dt { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.info dd { margin-top: .15rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips span {
  padding: .35rem .95rem; border-radius: 999px; font-size: .88rem;
  background: rgba(var(--tint),.14); border: 1px solid rgba(var(--tint),.35);
  transition: transform .2s, background .2s;
}
.chips span:hover { transform: translateY(-2px); background: rgba(var(--tint),.28); }

/* Lưới thẻ (dự án + social) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.3rem; }
.card {
  display: flex; flex-direction: column; gap: .7rem; padding: 1.4rem;
  animation: fadeUp .7s var(--d, 0s) both;
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.card:hover { transform: translateY(-6px); border-color: rgba(var(--tint),.6); box-shadow: 0 16px 50px rgba(var(--glow),.3); }
.card h4 { font-size: 1.15rem; font-weight: 600; word-break: break-word; }
.card p { color: var(--muted); font-size: .92rem; line-height: 1.6; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--muted); align-items: center; }
.lang::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #aaa); margin-right: .35rem; }
.topics { display: flex; flex-wrap: wrap; gap: .35rem; }
.topics span { font-size: .72rem; padding: .15rem .6rem; border-radius: 999px; background: rgba(var(--tint),.16); }
.note { margin-top: 1.5rem; color: var(--muted); text-align: center; }

.socials { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.social { flex-direction: row; align-items: center; gap: 1rem; }
.social img { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(var(--tint),.6)); }
.social b { display: block; font-size: 1.05rem; }
.social small { color: var(--muted); }

.footer {
  position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; z-index: 5;
  font-size: .75rem; letter-spacing: .15em; color: rgba(255,255,255,.45); pointer-events: none;
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; padding-top: 12px; padding-bottom: 12px; row-gap: 8px; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; gap: 1rem; }
  .nav a { font-size: .88rem; letter-spacing: .03em; }
  .logo { font-size: 1.5rem; margin-left: 0; }
  .mini small { display: none; }
  main.home { left: 50%; transform: translateX(-50%); top: 24vh; animation: fadeUpC 1s .2s both; }
  @keyframes fadeUpC { from { opacity: 0; transform: translate(-50%, 22px); } to { opacity: 1; transform: translateX(-50%); } }
  .page { padding-top: 150px; }
  .about { grid-template-columns: 1fr; text-align: center; padding: 1.6rem; }
  .avatar-wrap { margin: 0 auto; }
  .info { grid-template-columns: 1fr; text-align: left; }
  .chips { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Trình phát nhạc ---------- */
.music { transition: opacity .35s, transform .35s; }
.music.hidden { opacity: 0; transform: translateY(14px); pointer-events: none; }
.music {
  position: fixed; left: 18px; bottom: 18px; z-index: 10;
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .9rem .4rem .45rem; border-radius: 999px; font-size: .8rem;
}
.music .mbtn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--glass-line);
  background: rgba(var(--tint),.2); color: var(--text); cursor: pointer; font-size: .75rem;
  display: grid; place-items: center; transition: background .2s, transform .2s;
}
.music .mbtn:hover { background: rgba(var(--tint),.4); transform: scale(1.08); }
.music .mtitle { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.music .mvol { width: 80px; accent-color: var(--accent); cursor: pointer; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars span { width: 3px; height: 4px; border-radius: 2px; background: var(--accent); }
.music.playing .bars span { animation: eq 1s ease-in-out infinite; }
.music.playing .bars span:nth-child(2) { animation-delay: .25s; }
.music.playing .bars span:nth-child(3) { animation-delay: .5s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 14px; } }
@media (max-width: 820px) { .music .mtitle, .music .mvol { display: none; } .music { left: 12px; bottom: 12px; } }

/* ---------- Secret keypad ---------- */
.keybox { max-width: 360px; margin: 0 auto; padding: 2rem 1.8rem 2.2rem; text-align: center; transition: box-shadow .4s, border-color .4s; }
.kdisplay { display: flex; justify-content: center; gap: .9rem; height: 2.4rem; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); transition: background .2s, box-shadow .2s, transform .2s; }
.dot.on { background: var(--accent); box-shadow: 0 0 14px var(--accent); transform: scale(1.15); }
.khint { margin: .6rem 0 1.4rem; font-size: .9rem; letter-spacing: .12em; color: var(--muted); min-height: 1.3em; }
.khint.good { color: #7dffb0; } .khint.bad { color: #ff8d8d; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; justify-items: center; }
.key {
  width: 76px; height: 76px; border-radius: 50%; cursor: pointer;
  font-family: var(--serif); font-size: 2rem; color: var(--text);
  background: rgba(var(--tint),.14); border: 1px solid var(--glass-line);
  transition: transform .15s, background .2s, box-shadow .2s;
}
.key.small { font-family: var(--sans); font-size: 1.1rem; color: var(--muted); }
.key:hover { background: rgba(var(--tint),.3); box-shadow: 0 0 22px rgba(var(--tint),.45); transform: translateY(-2px); }
.key:active { transform: scale(.92); }
.keybox.ok { border-color: #7dffb0; box-shadow: 0 0 50px rgba(125,255,176,.35); }
.keybox.ok .dot.on { background: #7dffb0; border-color: #7dffb0; box-shadow: 0 0 14px #7dffb0; }
.keybox.shake { animation: shake .5s; border-color: #ff8d8d; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(7px); } }
@media (max-width: 400px) { .key { width: 64px; height: 64px; } }

/* ---------- Nút máy tính -> secret ---------- */
.calc-btn {
  position: fixed; right: 18px; bottom: 18px; z-index: 10;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); opacity: .75;
  transition: opacity .25s, transform .25s, box-shadow .25s, border-color .25s;
}
.calc-btn:hover { opacity: 1; transform: translateY(-3px) rotate(-6deg); border-color: rgba(var(--tint),.65); box-shadow: 0 8px 30px rgba(var(--glow),.45); }
@media (max-width: 820px) { .calc-btn { right: 12px; bottom: 12px; } }

/* ---------- Chuyển trang kiểu SPA ---------- */
@keyframes fadeOut { to { opacity: 0; } }
main.leaving-main { animation: fadeOut .25s ease both !important; pointer-events: none; }
.calc-btn.gone { display: none; }


/* ======================= GIAO DIỆN THEO MÙA ======================= */
html[data-theme="tet"] {
  --accent: #ffd166; --accent2: #ff6b5e;
  --glass: rgba(64,8,14, .46); --glass-line: rgba(255,205,120, .32); --muted: rgba(255,240,222, .8);
  --tint: 255,170,110; --glow: 255,110,90;
}
html[data-theme="tet"] .overlay {
  background:
    radial-gradient(ellipse at 20% 40%, rgba(70,6,12,.55), transparent 60%),
    linear-gradient(to bottom, rgba(55,4,10,.45), rgba(25,6,12,.1) 35%, rgba(25,6,12,.5));
}
html[data-theme="tet"] body:not(.home) .overlay { background: linear-gradient(rgba(58,6,12,.68), rgba(24,8,14,.6)); }
html[data-theme="tet"] .topbar { background: linear-gradient(rgba(45,4,8,.6), transparent); }
html[data-theme="summer"] {
  --accent: #8fe9ff; --accent2: #ffc27a;
  --glass: rgba(8,50,80, .46); --glass-line: rgba(190,240,255, .32); --muted: rgba(235,250,255, .8);
  --tint: 130,220,255; --glow: 60,180,230;
}
html[data-theme="summer"] .overlay {
  background:
    radial-gradient(ellipse at 20% 40%, rgba(6,50,80,.55), transparent 60%),
    linear-gradient(to bottom, rgba(6,40,70,.45), rgba(5,35,65,.1) 35%, rgba(5,35,65,.5));
}
html[data-theme="summer"] body:not(.home) .overlay { background: linear-gradient(rgba(8,45,75,.68), rgba(6,35,65,.6)); }
html[data-theme="summer"] .topbar { background: linear-gradient(rgba(4,30,55,.6), transparent); }
html[data-theme="halloween"] {
  --accent: #ff9a3c; --accent2: #b57bff;
  --glass: rgba(30,10,44, .46); --glass-line: rgba(255,160,80, .32); --muted: rgba(255,240,228, .8);
  --tint: 255,150,70; --glow: 170,90,255;
}
html[data-theme="halloween"] .overlay {
  background:
    radial-gradient(ellipse at 20% 40%, rgba(35,6,48,.55), transparent 60%),
    linear-gradient(to bottom, rgba(20,4,30,.45), rgba(12,4,24,.1) 35%, rgba(12,4,24,.5));
}
html[data-theme="halloween"] body:not(.home) .overlay { background: linear-gradient(rgba(30,8,44,.68), rgba(14,6,26,.6)); }
html[data-theme="halloween"] .topbar { background: linear-gradient(rgba(20,4,30,.6), transparent); }
html[data-theme="christmas"] {
  --accent: #ffd98a; --accent2: #ff8f8f;
  --glass: rgba(44,12,28, .46); --glass-line: rgba(255,214,170, .32); --muted: rgba(255,240,228, .8);
  --tint: 255,170,130; --glow: 255,120,110;
}
html[data-theme="christmas"] .overlay {
  background:
    radial-gradient(ellipse at 20% 40%, rgba(45,8,22,.55), transparent 60%),
    linear-gradient(to bottom, rgba(30,6,18,.45), rgba(6,12,26,.1) 35%, rgba(6,12,26,.5));
}
html[data-theme="christmas"] body:not(.home) .overlay { background: linear-gradient(rgba(36,8,22,.68), rgba(8,12,30,.6)); }
html[data-theme="christmas"] .topbar { background: linear-gradient(rgba(30,6,16,.6), transparent); }

/* Trang trí cạnh logo */
html[data-theme]:not([data-theme="default"]) .logo { position: relative; }
html[data-theme="tet"] .logo::before, html[data-theme="halloween"] .logo::before, html[data-theme="summer"] .logo::before {
  position: absolute; left: -32px; top: 50%; transform: translateY(-50%) rotate(-8deg); font-size: 1.3rem; letter-spacing: 0;
}
html[data-theme="tet"] .logo::before { content: "🧧"; }
html[data-theme="halloween"] .logo::before { content: "🎃"; }
html[data-theme="summer"] .logo::before { content: "🌴"; }
html[data-theme="christmas"] .logo::before {
  content: ""; position: absolute; left: -16px; top: -17px; width: 40px; height: 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 34'%3E%3Cpath d='M6 26 C8 10 20 4 32 8 C28 10 26 16 28 26 Z' fill='%23e63946'/%3E%3Crect x='3' y='24' width='30' height='7' rx='3.5' fill='%23ffffff'/%3E%3Ccircle cx='33' cy='8' r='4.5' fill='%23ffffff'/%3E%3C/svg%3E") no-repeat center / contain;
  transform: rotate(-14deg); filter: drop-shadow(0 0 5px rgba(255,90,100,.55));
}
.greet { margin-top: .9rem; font-size: .95rem; letter-spacing: .12em; color: var(--accent); }

/* Lớp trang trí */
.decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.decor-front { z-index: 20; }
.decor-back { z-index: -1; }

/* Giáng sinh: dây đèn */
.lights { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 1.5vw; list-style: none; }
.lights::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 2px; background: #18141c; }
.lights li { position: relative; width: 9px; height: 15px; margin-top: 4px; border-radius: 50% 50% 45% 45%; background: var(--c); box-shadow: 0 0 10px 2px var(--c); animation: twinkle 1.4s ease-in-out infinite alternate; }
.lights li:nth-child(even) { margin-top: 9px; }
@keyframes twinkle { from { opacity: .45; filter: brightness(.8); } to { opacity: 1; filter: brightness(1.25); } }

/* Tết: đèn lồng */
.lantern { position: absolute; top: 0; width: 46px; transform-origin: 50% 0; animation: swing 4s ease-in-out infinite alternate; }
.lantern .string { display: block; width: 2px; height: 34px; margin: 0 auto; background: #e0b34a; }
.lantern .lamp {
  height: 54px; display: grid; place-items: center; border-radius: 48% / 42%;
  background: radial-gradient(circle at 35% 30%, #ff6b5e, #c8102e 60%, #8f0a1e);
  border-top: 5px solid #e8b94a; border-bottom: 5px solid #e8b94a;
  box-shadow: 0 0 22px rgba(255,80,60,.6), inset 0 -6px 10px rgba(0,0,0,.25);
  color: #ffe08a; font-family: var(--serif); font-weight: 600; font-size: .8rem;
}
.lantern .tassel { display: block; width: 3px; height: 18px; margin: 0 auto; background: linear-gradient(#e8b94a, #ffd98a); box-shadow: 0 0 6px #ffd166; }
@keyframes swing { from { transform: scale(var(--s, 1)) rotate(-5deg); } to { transform: scale(var(--s, 1)) rotate(5deg); } }

/* Halloween: dơi + nhện */
.bat { position: absolute; left: -60px; font-size: 1.5rem; opacity: .85; filter: drop-shadow(0 0 6px rgba(170,90,255,.7)); animation: batfly 18s linear infinite; }
@keyframes batfly {
  0% { transform: translate(0, 0); } 25% { transform: translate(30vw, -18px); } 50% { transform: translate(60vw, 14px); }
  75% { transform: translate(90vw, -10px); } 100% { transform: translate(118vw, 6px); }
}
.spider { position: absolute; top: 0; left: 72%; display: flex; flex-direction: column; align-items: center; animation: spiderdrop 5s ease-in-out infinite alternate; }
.spider i { width: 1px; height: 70px; background: rgba(255,255,255,.55); }
.spider b { font-size: 1.5rem; font-weight: 400; filter: drop-shadow(0 0 6px rgba(255,150,70,.6)); }
@keyframes spiderdrop { from { transform: translateY(-30px); } to { transform: translateY(18px); } }

/* Hè: nắng + sóng */
.sun { position: absolute; top: -150px; right: -110px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,226,120,.55), rgba(255,190,90,.18) 45%, transparent 70%); animation: sunpulse 6s ease-in-out infinite alternate; }
@keyframes sunpulse { from { transform: scale(1); opacity: .8; } to { transform: scale(1.12); opacity: 1; } }
.wave { position: absolute; left: 0; bottom: 0; width: 200%; height: 110px; animation: wave 16s linear infinite; }
.wave svg { width: 100%; height: 100%; display: block; }
.wave.w2 { height: 80px; bottom: -6px; animation-duration: 24s; animation-direction: reverse; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (max-width: 820px) {
  .lantern { display: none; }
  html[data-theme]:not([data-theme="default"]) .logo { margin-left: 26px; }
}

/* ---------- Nút + menu đổi giao diện ---------- */
.theme-btn {
  position: fixed; right: 18px; bottom: 74px; z-index: 10; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.25rem; cursor: pointer; color: var(--text);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.theme-btn:hover { transform: translateY(-3px) rotate(8deg); border-color: rgba(var(--tint), .65); box-shadow: 0 8px 30px rgba(var(--glow), .4); }
.theme-menu {
  position: fixed; right: 18px; bottom: 130px; z-index: 30; padding: .5rem; border-radius: 16px;
  display: flex; flex-direction: column; gap: 2px; min-width: 190px;
  transition: opacity .2s, transform .2s;
}
.theme-menu.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }
.theme-opt {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .8rem; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; text-align: left;
  transition: background .2s;
}
.theme-opt:hover { background: rgba(var(--tint), .18); }
.theme-opt.on { background: rgba(var(--tint), .28); box-shadow: inset 0 0 0 1px rgba(var(--tint), .5); }
.theme-opt .ti { width: 1.4rem; text-align: center; }
@media (max-width: 820px) { .theme-btn { right: 12px; bottom: 68px; } .theme-menu { right: 12px; bottom: 124px; } }


/* ---------- Bộ đếm lượt xem + nút ngôi sao ---------- */
.visitor-widget {
  position: fixed; left: 16px; bottom: 16px; z-index: 50;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 9px 12px; border: 1px solid var(--glass-line); border-radius: 14px;
  background: rgba(12, 16, 38, .72); color: var(--text);
  box-shadow: 0 8px 28px rgba(0,0,0,.2); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); font-size: .78rem;
}
.visitor-count { display: flex; align-items: center; gap: 7px; min-width: 0; }
.visitor-count svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.visitor-label { line-height: 1.35; }
.visitor-star {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 6px; border: 1px solid rgba(255, 210, 90, .35); border-radius: 9px;
  color: #ffe29a; background: rgba(255, 210, 90, .08); font: inherit; cursor: pointer;
  transition: transform .2s, background .2s, border-color .2s;
}
.visitor-star svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.visitor-star:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 210, 90, .18); border-color: rgba(255, 210, 90, .7); }
.visitor-star.is-starred svg { fill: currentColor; }
.visitor-star:disabled { cursor: wait; opacity: .7; }
.visitor-star:focus-visible { outline: 2px solid #ffe29a; outline-offset: 3px; }
@media (max-width: 480px) {
  .visitor-widget { left: 10px; bottom: 10px; gap: 7px; padding: 8px 9px; font-size: .7rem; }
  .visitor-count { gap: 5px; }
  .visitor-count svg { flex-basis: 15px; width: 15px; height: 15px; }
}
