/* Giao diện anime: chủ đề, cảnh nền, Hoshi, hiệu ứng. Chỉ animate transform/opacity, không có vòng lặp JS.
   Mức hiệu ứng: html[data-fx] = full | lite | off. Chủ đề "classic" không có class .anime. */
:root {
  --fox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M7 14 5 2l11 8zM33 14l2-12-11 8z' fill='%23ffa552' stroke='%235b3a4a' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cellipse cx='20' cy='22' rx='15' ry='13' fill='%23ffa552' stroke='%235b3a4a' stroke-width='1.5'/%3E%3Cellipse cx='20' cy='27' rx='10' ry='7' fill='%23fff6ea'/%3E%3C/svg%3E");
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0c1 6 4 9 10 10-6 1-9 4-10 10-1-6-4-9-10-10 6-1 9-4 10-10z' fill='%23ffcf4d'/%3E%3C/svg%3E");
}

@font-face {
  font-family: "Baloo 2";
  font-weight: 500 800;
  font-display: swap;
  src: url(../fonts/baloo2-vietnamese.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Baloo 2";
  font-weight: 500 800;
  font-display: swap;
  src: url(../fonts/baloo2-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Baloo 2";
  font-weight: 500 800;
  font-display: swap;
  src: url(../fonts/baloo2-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- chủ đề ---------------------------------------------------------------------------- */
html[data-theme="night"] {
  --bg: #0f1230;
  --surface: #181b40;
  --surface-2: #21255a;
  --border: #323878;
  --text: #eef0ff;
  --muted: #a9aedb;
  --accent: #a891ff;
  --accent-hover: #c0afff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(168, 145, 255, 0.16);
  --ok: #6ee7b0;
  --ok-soft: rgba(110, 231, 176, 0.14);
  --warn: #ffd27a;
  --warn-soft: rgba(255, 210, 122, 0.14);
  --err: #ff93a6;
  --err-soft: rgba(255, 147, 166, 0.16);
  --soon: #8fd3ff;
  --soon-soft: rgba(143, 211, 255, 0.14);
  --shadow: 0 14px 34px -22px rgba(0, 0, 0, 0.8);
  --grad-1: #8b7bff;
  --grad-2: #ff7ac8;
  --ink: #241b4d;
  --card-shadow: #8b7bff;
  --card-bg: #fffaf3;
  --sky: linear-gradient(180deg, #080b26 0%, #121845 48%, #2b1f58 82%, #4a2a66 100%);
  --land-far: #1b1a46;
  --land-near: #120f30;
  --torii: #7d2847;
  --window: #ffd77a;
  --mote: #fff3a8;
  --overlay-rgb: 10, 12, 35;
  color-scheme: dark;
}

html[data-theme="sakura"] {
  --bg: #fff6fa;
  --surface: #ffffff;
  --surface-2: #fff0f6;
  --border: #f5d3e1;
  --text: #3b2441;
  --muted: #8d6d88;
  --accent: #e2558f;
  --accent-hover: #c94079;
  --accent-ink: #ffffff;
  --accent-soft: #ffe3ef;
  --ok: #1d8a57;
  --ok-soft: #e1f6ea;
  --warn: #a35a00;
  --warn-soft: #fff0d6;
  --err: #c0283f;
  --err-soft: #ffe4e8;
  --soon: #1e6fb0;
  --soon-soft: #e3f1ff;
  --shadow: 0 12px 30px -22px rgba(150, 60, 110, 0.45);
  --grad-1: #ff8fb8;
  --grad-2: #b98cff;
  --ink: #5a2a4a;
  --card-shadow: #ff9fc3;
  --card-bg: #fffafc;
  --sky: linear-gradient(180deg, #ffd9e8 0%, #ffe9f2 45%, #f3e3ff 100%);
  --land-far: #f2b8d0;
  --land-near: #e48bb0;
  --torii: #d9415f;
  --window: #fff1a8;
  --mote: #ffb7cf;
  --overlay-rgb: 255, 246, 250;
  color-scheme: light;
}

html[data-theme="summer"] {
  --bg: #f1f8ff;
  --surface: #ffffff;
  --surface-2: #eaf5ff;
  --border: #cde4f6;
  --text: #15314a;
  --muted: #5a7690;
  --accent: #1688dc;
  --accent-hover: #0f6fb8;
  --accent-ink: #ffffff;
  --accent-soft: #dcefff;
  --ok: #157f4a;
  --ok-soft: #dff5e9;
  --warn: #9a5a00;
  --warn-soft: #fff1d6;
  --err: #be2b3a;
  --err-soft: #ffe4e6;
  --soon: #6b4fd8;
  --soon-soft: #ece6ff;
  --shadow: 0 12px 30px -22px rgba(30, 90, 150, 0.45);
  --grad-1: #38b6ff;
  --grad-2: #2fd4a4;
  --ink: #17324a;
  --card-shadow: #6cc8ff;
  --card-bg: #ffffff;
  --sky: linear-gradient(180deg, #6cc6ff 0%, #a6defc 50%, #e4f6ff 100%);
  --land-far: #8fd3a2;
  --land-near: #4fb978;
  --torii: #e0503f;
  --window: #fff2b0;
  --mote: #ffffff;
  --overlay-rgb: 241, 248, 255;
  color-scheme: light;
}

.badge-soon {
  background: var(--soon-soft, #e6f2ff);
  color: var(--soon, #1d6fb8);
}

/* ---- khung ứng dụng trên nền trời ----------------------------------------------------------- */
.anime body {
  background: var(--bg);
}

.anime h1,
.anime h2,
.anime h3,
.anime .brand strong,
.anime .nav-toggle {
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.01em;
}

.anime .card h3 {
  font-size: 18px;
  font-weight: 700;
}

.app-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--sky);
  pointer-events: none;
}

.anime .app {
  position: relative;
  z-index: 1;
}

.anime .sidebar,
.anime .topbar {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.anime .topbar {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.anime .card,
.anime .stat {
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.anime .brand-mark {
  border-radius: 12px;
  font-size: 19px;
}

/* menu: mục đang chọn là viên gradient có ngôi sao lấp lánh */
.anime .nav a {
  transition: background 0.15s, transform 0.15s;
}

.anime .nav a:hover {
  transform: translateX(2px);
}

.anime .nav a.is-active {
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--grad-2);
}

.anime .nav a.is-active::after {
  content: "✦";
  float: right;
  font-size: 12px;
}

.anime .nav-sign {
  transition: transform 0.25s ease;
}

.anime .nav-group.is-open .nav-sign {
  transform: rotate(180deg);
}

/* nút: nổi nhẹ khi rê chuột, nút chính có vệt sáng lướt qua */
.anime .btn {
  border-radius: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.anime .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.anime .btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.anime .btn-primary {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  color: #fff;
  box-shadow: 0 6px 16px -10px var(--grad-2);
}

.anime .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  filter: saturate(1.15) brightness(1.04);
}

.anime .btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}

.anime[data-fx="full"] .btn-primary:hover::after {
  transform: translateX(120%);
  transition: transform 0.65s ease;
}

.anime input:focus,
.anime select:focus,
.anime textarea:focus {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* chuyển trang: nội dung mờ dần và trượt lên */
.anime:not([data-fx="off"]) .view > * {
  animation: pageIn 0.2s ease-out both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* biểu tượng đang tải: ngôi sao 4 cánh xoay */
.anime .spinner {
  border: 0;
  border-radius: 0;
  background: var(--star) center/contain no-repeat;
  animation-duration: 1.1s;
}

/* bảng trống: Hoshi ngủ gật */
.anime .table .empty::before {
  content: "";
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M11 21q3 3 6 0M23 21q3 3 6 0' fill='none' stroke='%232b2350' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M18 28q2 1 4 0' fill='none' stroke='%233b2a3a' stroke-width='1.3' stroke-linecap='round'/%3E%3Ctext x='31' y='9' font-size='9' font-weight='800' fill='%239aa3ff'%3Ez%3C/text%3E%3C/svg%3E") center/contain no-repeat, var(--fox) center/contain no-repeat;
  opacity: 0.85;
}

/* thông báo: bong bóng thoại kèm mặt Hoshi */
.anime .toast {
  padding: 12px 18px 12px 56px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--card-bg);
  color: #2a2147;
  box-shadow: 4px 4px 0 var(--card-shadow);
  font-weight: 600;
}

.anime .toast::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M11 22q3-4 6 0M23 22q3-4 6 0' fill='none' stroke='%232b2350' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='9.5' cy='26' r='2.4' fill='%23ff8fb1' opacity='.6'/%3E%3Ccircle cx='30.5' cy='26' r='2.4' fill='%23ff8fb1' opacity='.6'/%3E%3Cpath d='M17 27q1.5 2 3 0q1.5 2 3 0' fill='none' stroke='%233b2a3a' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat, var(--fox) center/contain no-repeat;
}

.anime .toast.is-error {
  background: #fff1f3;
  color: #8a1830;
  border-color: #8a1830;
  box-shadow: 4px 4px 0 #ff93a6;
}

.anime .toast.is-error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cellipse cx='14' cy='21' rx='2.2' ry='2.8' fill='%232b2350'/%3E%3Cellipse cx='26' cy='21' rx='2.2' ry='2.8' fill='%232b2350'/%3E%3Cpath d='M16 29q2-2 4 0q2 2 4 0' fill='none' stroke='%233b2a3a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cpath d='M34 9q-3 5 0 7q3-2 0-7z' fill='%239fd8ff' stroke='%233b6b9a' stroke-width='1'/%3E%3C/svg%3E"), var(--fox);
}

.anime[data-fx="full"] .toast.is-visible {
  animation: toastPop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes toastPop {
  from {
    transform: translateY(10px) scale(0.92);
  }
}

/* bung sao khi chạy xong không lỗi */
.burst {
  position: fixed;
  z-index: 70;
  width: 0;
  height: 0;
  pointer-events: none;
}

.burst i {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  background: var(--star) center/contain no-repeat;
  animation: burst 0.8s ease-out forwards;
}

.burst i:nth-child(3n) {
  filter: hue-rotate(260deg) saturate(2);
}

@keyframes burst {
  from {
    opacity: 1;
    transform: translate(0, 0) scale(0.4) rotate(0deg);
  }
  to {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(120deg);
  }
}

/* Hoshi nhỏ ở chân menu + nút hiệu ứng */
.side-foot {
  display: none;
}

.anime .side-foot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 14px 12px;
}

.hoshi-side {
  flex: none;
  width: 74px;
  height: 74px;
  cursor: pointer;
}

.side-say {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.fx-btn {
  display: none !important;
}

.anime .fx-btn {
  display: inline-flex !important;
}

/* ---- trời: sao, sao băng, đom đóm / cánh hoa, ảnh nền -------------------------------------- */
.stars {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.stars-a {
  background-image:
    radial-gradient(1.6px 1.6px at 23px 41px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 91px 160px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.8px 1.8px at 170px 72px, #fff, transparent),
    radial-gradient(1px 1px at 241px 221px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.4px 1.4px at 287px 18px, #fff, transparent),
    radial-gradient(1px 1px at 52px 250px, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.3px 1.3px at 131px 119px, rgba(255, 245, 210, 0.9), transparent);
  background-size: 317px 283px;
}

.stars-b {
  background-image:
    radial-gradient(2.2px 2.2px at 64px 88px, #fff, transparent),
    radial-gradient(1.4px 1.4px at 211px 304px, rgba(220, 225, 255, 0.9), transparent),
    radial-gradient(1.8px 1.8px at 395px 41px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 466px 377px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 330px 199px, rgba(255, 240, 200, 0.95), transparent);
  background-size: 523px 461px;
}

.anime[data-fx="full"] .stars-a {
  animation: twinkle 3.6s ease-in-out infinite alternate;
}

.anime[data-fx="full"] .stars-b {
  animation: twinkle 5.2s ease-in-out 1.3s infinite alternate-reverse;
}

@keyframes twinkle {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.35;
  }
}

.shooting {
  position: absolute;
  top: 10%;
  left: 72%;
  width: 130px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));
  opacity: 0;
}

.shooting.s2 {
  top: 26%;
  left: 38%;
  width: 90px;
}

.anime[data-fx="full"][data-theme="night"] .shooting {
  animation: shoot 12s linear 2s infinite;
}

.anime[data-fx="full"][data-theme="night"] .shooting.s2 {
  animation: shoot 17s linear 8s infinite;
}

.anime[data-fx="full"][data-theme="night"] .app-sky .shooting {
  animation-duration: 24s;
}

@keyframes shoot {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(-24deg);
  }
  1.5% {
    opacity: 1;
  }
  7% {
    opacity: 0;
    transform: translate(-420px, 190px) rotate(-24deg);
  }
  100% {
    opacity: 0;
    transform: translate(-420px, 190px) rotate(-24deg);
  }
}

[data-theme="sakura"] .stars,
[data-theme="summer"] .stars,
[data-theme="sakura"] .shooting,
[data-theme="summer"] .shooting {
  display: none;
}

.motes {
  position: absolute;
  inset: 0;
}

.motes i {
  position: absolute;
  bottom: 8%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mote) 0 35%, transparent 70%);
  opacity: 0;
}

.motes i:nth-child(1) { left: 8%; animation-delay: 0s; animation-duration: 11s; }
.motes i:nth-child(2) { left: 19%; animation-delay: 3s; animation-duration: 14s; }
.motes i:nth-child(3) { left: 31%; animation-delay: 6s; animation-duration: 12s; }
.motes i:nth-child(4) { left: 44%; animation-delay: 1.5s; animation-duration: 15s; }
.motes i:nth-child(5) { left: 57%; animation-delay: 8s; animation-duration: 13s; }
.motes i:nth-child(6) { left: 66%; animation-delay: 4s; animation-duration: 16s; }
.motes i:nth-child(7) { left: 74%; animation-delay: 10s; animation-duration: 12s; }
.motes i:nth-child(8) { left: 83%; animation-delay: 2.5s; animation-duration: 14s; }
.motes i:nth-child(9) { left: 91%; animation-delay: 7s; animation-duration: 11s; }
.motes i:nth-child(10) { left: 50%; animation-delay: 12s; animation-duration: 17s; }

.anime[data-fx="full"] .motes i {
  animation-name: rise;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes rise {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }
  20% {
    opacity: 1;
  }
  60% {
    transform: translate(18px, -38vh);
  }
  100% {
    opacity: 0;
    transform: translate(-10px, -70vh);
  }
}

/* sakura: cánh hoa rơi thay cho đom đóm */
[data-theme="sakura"] .motes i {
  top: -16px;
  bottom: auto;
  width: 11px;
  height: 8px;
  border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #ffd1e0, #ff9fc0);
}

.anime[data-fx="full"][data-theme="sakura"] .motes i {
  animation-name: petal;
  animation-timing-function: linear;
}

@keyframes petal {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  8% {
    opacity: 0.95;
  }
  50% {
    transform: translate(-40px, 52vh) rotate(200deg);
  }
  100% {
    opacity: 0.9;
    transform: translate(30px, 108vh) rotate(420deg);
  }
}

.scene-photo {
  position: absolute;
  inset: -24px;
  display: none;
  background: var(--bg-photo) center / cover no-repeat;
  filter: blur(var(--bg-blur, 0px));
}

.has-photo .scene-photo {
  display: block;
}

.has-photo .scene-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(var(--overlay-rgb, 10, 12, 35), var(--bg-overlay, 0.45));
}

.has-photo .stars,
.has-photo .moon,
.has-photo .cloud,
.has-photo .land {
  display: none;
}

/* ---- trang đăng nhập ------------------------------------------------------------------------ */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--sky, #10142f);
  pointer-events: none;
}

html:not(.anime) .scene,
html:not(.anime) .app-sky,
html:not(.anime) .hoshi-perch {
  display: none;
}

.moon {
  position: absolute;
  top: 9%;
  right: 13%;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffdf0, #ffecb0 58%, #f2cf78);
  box-shadow: 0 0 40px 12px rgba(255, 236, 170, 0.32), 0 0 140px 50px rgba(255, 220, 150, 0.1);
}

.moon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 58%, rgba(210, 170, 90, 0.35) 0 9%, transparent 10%),
    radial-gradient(circle at 40% 70%, rgba(210, 170, 90, 0.25) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 30%, rgba(210, 170, 90, 0.22) 0 5%, transparent 6%);
}

[data-theme="sakura"] .moon {
  background: radial-gradient(circle at 40% 38%, #fff, #ffe3ee 60%, #ffc7dc);
  box-shadow: 0 0 60px 20px rgba(255, 200, 225, 0.45);
}

[data-theme="sakura"] .moon::before,
[data-theme="summer"] .moon::before {
  display: none;
}

[data-theme="summer"] .moon {
  background: radial-gradient(circle, #fffbe0, #ffe27a 65%, #ffcf4d);
  box-shadow: 0 0 60px 26px rgba(255, 230, 120, 0.55);
}

.cloud {
  position: absolute;
  top: 16%;
  left: -260px;
  width: 240px;
  height: 46px;
  border-radius: 999px;
  background: rgba(190, 180, 255, 0.13);
  box-shadow: 60px -18px 0 4px rgba(190, 180, 255, 0.1), 130px -6px 0 -2px rgba(190, 180, 255, 0.11);
  filter: blur(3px);
}

.cloud.cloud-b {
  top: 30%;
  width: 180px;
  height: 34px;
}

[data-theme="summer"] .cloud,
[data-theme="sakura"] .cloud {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 60px -20px 0 6px rgba(255, 255, 255, 0.85), 130px -6px 0 0 rgba(255, 255, 255, 0.8);
}

.anime[data-fx="full"] .cloud {
  animation: drift 95s linear infinite;
}

.anime[data-fx="full"] .cloud.cloud-b {
  animation-duration: 130s;
  animation-delay: -60s;
}

@keyframes drift {
  to {
    transform: translateX(calc(100vw + 520px));
  }
}

.land {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 34vh;
  min-height: 180px;
}

.land .far {
  fill: var(--land-far);
}

.land .near {
  fill: var(--land-near);
}

.land .torii {
  fill: var(--torii);
}

.land .lit {
  fill: var(--window);
}

.anime[data-fx="full"] .land .lit {
  animation: windowGlow 4s ease-in-out infinite alternate;
}

@keyframes windowGlow {
  to {
    opacity: 0.6;
  }
}

.login-body {
  min-height: 100vh;
}

.anime .login-page {
  position: relative;
  z-index: 2;
  padding: 150px 16px 48px;
}

.login-stage {
  position: relative;
  width: min(400px, 100%);
}

.hoshi-perch {
  position: absolute;
  right: 4px;
  bottom: calc(100% - 26px);
  z-index: 3;
  width: 100%;
  height: 140px;
  pointer-events: none;
}

.hoshi-login {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 140px;
  height: 140px;
  pointer-events: auto;
}

.bubble {
  position: absolute;
  right: 160px;
  bottom: 70px;
  max-width: 220px;
  margin: 0;
  padding: 8px 13px;
  border: 2.5px solid var(--ink, #241b4d);
  border-radius: 16px;
  background: #fff;
  color: #2a2147;
  font: 700 14.5px/1.35 "Baloo 2", "Segoe UI", system-ui, sans-serif;
  box-shadow: 3px 3px 0 var(--card-shadow, #8b7bff);
}

.bubble::after {
  content: "";
  position: absolute;
  right: -11px;
  bottom: 12px;
  width: 16px;
  height: 16px;
  border-right: 2.5px solid var(--ink, #241b4d);
  border-bottom: 2.5px solid var(--ink, #241b4d);
  background: #fff;
  transform: rotate(-45deg) skew(10deg, 10deg);
}

.anime:not([data-fx="off"]) .bubble.pop {
  animation: bubblePop 0.32s cubic-bezier(0.3, 1.7, 0.5, 1);
}

@keyframes bubblePop {
  from {
    transform: scale(0.85);
    opacity: 0.4;
  }
}

.anime .login-card {
  --text: #2a2147;
  --muted: #6b6390;
  --surface: #ffffff;
  --surface-2: #f6f2ff;
  --border: #d9d2f2;
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 26px 24px 22px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 8px 8px 0 var(--card-shadow), 0 30px 60px -28px rgba(0, 0, 0, 0.6);
}

.anime .login-card .brand strong {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.anime .login-card .brand-mark {
  width: 48px;
  height: 48px;
}

.anime .login-card .brand-mark img {
  width: 46px;
  height: 46px;
}

.anime .login-card input {
  border-width: 2px;
  border-radius: 12px;
}

.pw-wrap {
  position: relative;
  display: block;
}

.pw-wrap input {
  padding-right: 46px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.pw-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.pw-toggle .pw-slash {
  display: none;
}

.pw-toggle[aria-pressed="true"] .pw-slash {
  display: inline;
}

.caps-hint {
  margin: -6px 0 12px;
  color: #a35a00;
  font-size: 13px;
  font-weight: 600;
}

.anime .btn-login {
  width: 100%;
  height: 48px;
  border: 2.5px solid var(--ink) !important;
  border-radius: 14px;
  font: 800 17px/1 "Baloo 2", "Segoe UI", system-ui, sans-serif;
  box-shadow: 4px 4px 0 var(--ink);
}

.anime .btn-login:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.anime:not([data-fx="off"]) .login-card.shake {
  animation: shake 0.45s;
}

@keyframes shake {
  20%, 60% {
    transform: translateX(-9px);
  }
  40%, 80% {
    transform: translateX(9px);
  }
}

.anime:not([data-fx="off"]) .leaving .login-stage {
  animation: leave 0.55s ease-in forwards;
}

@keyframes leave {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(1.04);
  }
}

/* ---- Hoshi ------------------------------------------------------------------------------------- */
.hoshi {
  --look: 0;
}

.hoshi-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hoshi-svg g,
.hoshi-svg path {
  transform-box: fill-box;
}

.h-eyes {
  transform: translateX(calc(var(--look) * 2.6px));
  transition: transform 0.18s ease;
}

.h-eye {
  transform-origin: center;
}

.h-eyes-happy,
.h-eyes-closed,
.h-mouth-sad,
.h-sweat,
.h-sparkles,
.h-zzz {
  opacity: 0;
  transition: opacity 0.2s;
}

.h-paw {
  transform-origin: center;
  transition: transform 0.32s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.h-tail {
  transform-origin: 8% 88%;
}

.h-lantern {
  transform-origin: 50% 0%;
}

.h-glow {
  transform-origin: center;
}

.is-cover .h-paw-l {
  transform: translate(8px, -36px) rotate(-14deg) scale(1.18);
}

.is-cover .h-paw-r {
  transform: translate(-8px, -36px) rotate(14deg) scale(1.18);
}

.is-peek .h-paw-l {
  transform: translate(8px, -23px) rotate(-14deg) scale(1.15);
}

.is-peek .h-paw-r {
  transform: translate(-8px, -23px) rotate(14deg) scale(1.15);
}

.is-sad .h-sweat,
.is-sad .h-mouth-sad,
.is-happy .h-eyes-happy,
.is-happy .h-sparkles,
.is-sleep .h-eyes-closed,
.is-sleep .h-zzz {
  opacity: 1;
}

.is-sad .h-mouth,
.is-happy .h-eyes,
.is-sleep .h-eyes {
  opacity: 0;
}

.is-sad .h-eye {
  transform: scaleY(0.82);
}

.is-sleep .h-lantern {
  opacity: 0.7;
}

/* chuyển động khi đứng yên (chỉ transform/opacity, phần lớn chạy trên compositor) */
.anime:not([data-fx="off"]) .hoshi {
  animation: hoshiBob 3.4s ease-in-out infinite;
}

.anime:not([data-fx="off"]) .h-eye {
  animation: blink 4.8s infinite;
}

.anime[data-fx="full"] .h-tail {
  animation: tailSway 2.8s ease-in-out infinite alternate;
}

.anime[data-fx="full"] .h-lantern {
  animation: lanternSwing 3.8s ease-in-out infinite alternate;
}

.anime[data-fx="full"] .h-glow {
  animation: glowPulse 2.6s ease-in-out infinite alternate;
}

.anime:not([data-fx="off"]) .is-working .h-lantern {
  animation: lanternSwing 0.9s ease-in-out infinite alternate;
}

.anime:not([data-fx="off"]) .is-happy .hoshi-svg {
  animation: hoshiJump 0.55s cubic-bezier(0.3, 1.6, 0.5, 1) 2;
}

.anime:not([data-fx="off"]) .is-sad .h-sweat {
  animation: sweat 1.2s ease-in infinite;
}

.anime:not([data-fx="off"]) .is-sleep .h-zzz {
  animation: zzz 2.4s ease-in-out infinite;
}

.anime:not([data-fx="off"]) .is-sleep {
  animation-duration: 5s;
}

@keyframes hoshiBob {
  50% {
    transform: translateY(-3px);
  }
}

@keyframes blink {
  0%,
  93%,
  100% {
    transform: scaleY(1);
  }
  96% {
    transform: scaleY(0.1);
  }
}

@keyframes tailSway {
  from {
    transform: rotate(-7deg);
  }
  to {
    transform: rotate(8deg);
  }
}

@keyframes lanternSwing {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}

@keyframes glowPulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@keyframes hoshiJump {
  45% {
    transform: translateY(-16px);
  }
}

@keyframes sweat {
  from {
    transform: translateY(-2px);
  }
  to {
    transform: translateY(5px);
  }
}

@keyframes zzz {
  50% {
    transform: translate(3px, -4px);
  }
}

/* ---- mức hiệu ứng, tab ẩn, màn hình nhỏ ----------------------------------------------------- */
.anime[data-fx="off"] *,
.anime[data-fx="off"] *::before,
.anime[data-fx="off"] *::after {
  animation: none !important;
  transition-duration: 0s !important;
}

.anime[data-fx="off"] .motes,
.anime[data-fx="off"] .shooting,
.anime[data-fx="lite"] .motes,
.anime[data-fx="lite"] .shooting {
  display: none;
}

.tab-hidden *,
.tab-hidden *::before,
.tab-hidden *::after {
  animation-play-state: paused !important;
}

@media (max-width: 900px) {
  .anime .login-page {
    padding-top: 136px;
  }

  .hoshi-login {
    width: 116px;
    height: 116px;
  }

  .hoshi-perch {
    height: 116px;
  }

  .bubble {
    right: 132px;
    bottom: 56px;
    max-width: 175px;
    font-size: 13px;
  }

  .moon {
    width: 64px;
    height: 64px;
  }

  .anime .side-foot {
    padding-bottom: 18px;
  }
}
