/* ==========================================================================
   DazhiMh — Premium Homepage
   Premium, cinematic, glassmorphic UI for the DazhiMh landing page.
   ========================================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: "HYTMR","PingFang SC","Microsoft YaHei","Helvetica Neue",
               Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-feature-settings: "tnum", "ss01";
  color: var(--fg);
  background: var(--bg-solid);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: .01em;
}
@font-face {
  font-family: HYTMR;
  src: url("https://npm.elemecdn.com/fontcdn-ariasaka@1.0.0/HYTangMeiRen55W.woff2") format("woff2");
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }

/* ---------- Themes ---------- */
body.theme-dark {
  --bg-solid:   #07080d;
  --fg:         #ecf3ff;
  --fg-soft:    rgba(236,243,255,.72);
  --fg-mute:    rgba(236,243,255,.55);
  --glass:      rgba(15,22,40,.45);
  --glass-2:    rgba(255,255,255,.06);
  --glass-edge: rgba(255,255,255,.14);
  --primary:    #5cc8ff;
  --primary-2:  #7a6dff;
  --accent:     #ff6bd6;
  --shadow:     0 10px 40px rgba(0,8,30,.55);
  --bg-overlay: linear-gradient(180deg, rgba(4,7,18,.55) 0%, rgba(4,7,18,.35) 35%, rgba(4,7,18,.65) 100%);
  --particle:   rgba(255,255,255,.55);
}
body.theme-light {
  --bg-solid:   #eef3ff;
  --fg:         #0d1b3a;
  --fg-soft:    #19284a;
  --fg-mute:    rgba(13,27,58,.72);
  --glass:      rgba(255,255,255,.72);
  --glass-2:    rgba(255,255,255,.55);
  --glass-edge: rgba(255,255,255,.95);
  --primary:    #1f7ad1;
  --primary-2:  #6d52d6;
  --accent:     #d1377a;
  --shadow:     0 14px 38px rgba(40,60,120,.22);
  --bg-overlay: linear-gradient(180deg, rgba(8,15,40,.15) 0%, rgba(8,15,40,.05) 35%, rgba(8,15,40,.25) 100%);
  --particle:   rgba(40,60,120,.45);
}

/* ---------- Background layers ---------- */
.bg-wrap {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  pointer-events: none;
}
.bg-lqip {
  position: absolute; inset: 0;
  background-image: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABQODxIPDRQSEBIXFRQYHjIhHhwcHj0sLiQySUBMS0dARkVQWnNiUFVtVkVGZIhlbXd7gYKBTmCNl4x9lnN+gXz/2wBDARUXFx4aHjshITt8U0ZTfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHz/wAARCAAhABgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDE04BbgMa1r9mlUAdMVnWMYL4NbiRq0WG7Vo1Zii1Y5SeIhzxRWtqkS4G0c0VVrkXJLWLZKOK1xF8tRLb+XICRWgiB1z2FXI56crowb2ItJjHFFa7W6yS8DIoqlsZynZjputWIv9SaKKmQUuoy2+8aKKKCHuf/2Q==");
  background-size: cover;
  background-position: center;
  filter: blur(20px) saturate(115%);
  transform: scale(1.15);
}
.bg-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Default (mobile) — UNCHANGED: keep original center crop */
  object-position: center center;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity .9s ease-out, transform 14s linear;
}
.bg-img.loaded {
  opacity: 1;
  transform: scale(1);
  animation: bgDrift 30s ease-in-out infinite alternate;
}
@keyframes bgDrift {
  from { transform: scale(1) translate(0,0); }
  to   { transform: scale(1.06) translate(-1.2%, -1%); }
}
.bg-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 35%, transparent 0%, rgba(0,0,0,.0) 40%, rgba(0,0,0,.55) 100%),
    var(--bg-overlay);
}
body.theme-dark .bg-img { filter: brightness(.6) saturate(105%); }
body.theme-light .bg-img { filter: brightness(.85) saturate(110%); }

.bg-grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  opacity: .35;
  mix-blend-mode: overlay;
  pointer-events: none;
}
body.theme-light .bg-grain { opacity: .18; }

/* Floating particles */
.bg-particles { position: absolute; inset: 0; pointer-events: none; }
.bg-particles span {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--particle);
  box-shadow: 0 0 8px var(--particle);
  opacity: .6;
  animation: floatY linear infinite;
}
.bg-particles span:nth-child(1)  { left:  5%; top: 80%; animation-duration: 18s; animation-delay: -2s; width:3px; height:3px; }
.bg-particles span:nth-child(2)  { left: 15%; top: 95%; animation-duration: 22s; animation-delay: -5s; }
.bg-particles span:nth-child(3)  { left: 25%; top: 75%; animation-duration: 26s; animation-delay: -8s; width:2px; height:2px; }
.bg-particles span:nth-child(4)  { left: 35%; top: 90%; animation-duration: 20s; animation-delay: -1s; }
.bg-particles span:nth-child(5)  { left: 45%; top: 85%; animation-duration: 24s; animation-delay: -10s; width:3px; height:3px; }
.bg-particles span:nth-child(6)  { left: 55%; top: 95%; animation-duration: 19s; animation-delay: -4s; }
.bg-particles span:nth-child(7)  { left: 65%; top: 78%; animation-duration: 28s; animation-delay: -7s; width:2px; height:2px; }
.bg-particles span:nth-child(8)  { left: 75%; top: 88%; animation-duration: 21s; animation-delay: -12s; }
.bg-particles span:nth-child(9)  { left: 85%; top: 92%; animation-duration: 25s; animation-delay: -3s; width:3px; height:3px; }
.bg-particles span:nth-child(10) { left: 95%; top: 80%; animation-duration: 23s; animation-delay: -9s; }
.bg-particles span:nth-child(11) { left: 10%; top: 60%; animation-duration: 27s; animation-delay: -6s; width:2px; height:2px; }
.bg-particles span:nth-child(12) { left: 30%; top: 65%; animation-duration: 22s; animation-delay: -11s; }
.bg-particles span:nth-child(13) { left: 50%; top: 70%; animation-duration: 24s; animation-delay: -13s; width:3px; height:3px; }
.bg-particles span:nth-child(14) { left: 70%; top: 60%; animation-duration: 26s; animation-delay: -14s; }
.bg-particles span:nth-child(15) { left: 90%; top: 65%; animation-duration: 20s; animation-delay: -2s; width:2px; height:2px; }
@keyframes floatY {
  0%   { transform: translateY(0)     translateX(0)  scale(1);   opacity: 0; }
  10%  {                                                          opacity: .8; }
  90%  {                                                          opacity: .8; }
  100% { transform: translateY(-110vh) translateX(20px) scale(.6); opacity: 0; }
}

/* ---------- Snowfall (restored from original) ---------- */
.snowfall { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.snowfall span {
  position: absolute;
  top: -10vh;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255,255,255,.65);
  opacity: .9;
  user-select: none;
  will-change: transform, opacity;
  animation-name: snowFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.snowfall span::before { content: "\2744"; }   /* ❄ snowflake */
.snowfall span:nth-child(8n+1)::before { content: "\2744"; }  /* ❄ */
.snowfall span:nth-child(8n+2)::before { content: "\2745"; }  /* ❅ */
.snowfall span:nth-child(8n+3)::before { content: "\2746"; }  /* ❆ */
.snowfall span:nth-child(8n+4)::before { content: "\2744"; }
.snowfall span:nth-child(8n+5)::before { content: "\2745"; }
.snowfall span:nth-child(8n+6)::before { content: "\2746"; }
.snowfall span:nth-child(8n+7)::before { content: "\2744"; }
.snowfall span:nth-child(8n+8)::before { content: "\2745"; }

/* Position / size / speed variation for 40 flakes */
.snowfall span:nth-child(1)  { left:  2%; font-size: 12px; animation-duration: 12s; animation-delay: -1s;  opacity:.7; }
.snowfall span:nth-child(2)  { left:  7%; font-size: 18px; animation-duration: 16s; animation-delay: -4s;  opacity:.85;}
.snowfall span:nth-child(3)  { left: 12%; font-size: 10px; animation-duration: 10s; animation-delay: -7s;  opacity:.6; }
.snowfall span:nth-child(4)  { left: 17%; font-size: 16px; animation-duration: 14s; animation-delay: -2s;  opacity:.8; }
.snowfall span:nth-child(5)  { left: 22%; font-size: 14px; animation-duration: 18s; animation-delay: -9s;  opacity:.75;}
.snowfall span:nth-child(6)  { left: 27%; font-size: 20px; animation-duration: 13s; animation-delay: -5s;  opacity:.9; }
.snowfall span:nth-child(7)  { left: 32%; font-size: 11px; animation-duration: 17s; animation-delay: -3s;  opacity:.65;}
.snowfall span:nth-child(8)  { left: 37%; font-size: 15px; animation-duration: 11s; animation-delay: -8s;  opacity:.8; }
.snowfall span:nth-child(9)  { left: 42%; font-size: 13px; animation-duration: 19s; animation-delay: -6s;  opacity:.7; }
.snowfall span:nth-child(10) { left: 47%; font-size: 17px; animation-duration: 15s; animation-delay: -10s; opacity:.85;}
.snowfall span:nth-child(11) { left: 52%; font-size: 12px; animation-duration: 14s; animation-delay: -2s;  opacity:.7; }
.snowfall span:nth-child(12) { left: 57%; font-size: 19px; animation-duration: 12s; animation-delay: -11s; opacity:.95;}
.snowfall span:nth-child(13) { left: 62%; font-size: 14px; animation-duration: 16s; animation-delay: -4s;  opacity:.75;}
.snowfall span:nth-child(14) { left: 67%; font-size: 10px; animation-duration: 18s; animation-delay: -7s;  opacity:.6; }
.snowfall span:nth-child(15) { left: 72%; font-size: 16px; animation-duration: 13s; animation-delay: -12s; opacity:.8; }
.snowfall span:nth-child(16) { left: 77%; font-size: 13px; animation-duration: 17s; animation-delay: -3s;  opacity:.7; }
.snowfall span:nth-child(17) { left: 82%; font-size: 18px; animation-duration: 10s; animation-delay: -8s;  opacity:.9; }
.snowfall span:nth-child(18) { left: 87%; font-size: 11px; animation-duration: 19s; animation-delay: -1s;  opacity:.65;}
.snowfall span:nth-child(19) { left: 92%; font-size: 15px; animation-duration: 14s; animation-delay: -9s;  opacity:.8; }
.snowfall span:nth-child(20) { left: 97%; font-size: 12px; animation-duration: 16s; animation-delay: -5s;  opacity:.7; }
.snowfall span:nth-child(21) { left:  5%; font-size: 14px; animation-duration: 11s; animation-delay: -6s;  opacity:.85;}
.snowfall span:nth-child(22) { left: 10%; font-size: 17px; animation-duration: 15s; animation-delay: -13s; opacity:.9; }
.snowfall span:nth-child(23) { left: 15%; font-size: 10px; animation-duration: 12s; animation-delay: -2s;  opacity:.6; }
.snowfall span:nth-child(24) { left: 20%; font-size: 13px; animation-duration: 18s; animation-delay: -10s; opacity:.7; }
.snowfall span:nth-child(25) { left: 25%; font-size: 19px; animation-duration: 13s; animation-delay: -4s;  opacity:.95;}
.snowfall span:nth-child(26) { left: 30%; font-size: 11px; animation-duration: 17s; animation-delay: -7s;  opacity:.65;}
.snowfall span:nth-child(27) { left: 35%; font-size: 14px; animation-duration: 14s; animation-delay: -11s; opacity:.75;}
.snowfall span:nth-child(28) { left: 40%; font-size: 16px; animation-duration: 10s; animation-delay: -3s;  opacity:.85;}
.snowfall span:nth-child(29) { left: 45%; font-size: 12px; animation-duration: 19s; animation-delay: -8s;  opacity:.7; }
.snowfall span:nth-child(30) { left: 50%; font-size: 15px; animation-duration: 15s; animation-delay: -1s;  opacity:.8; }
.snowfall span:nth-child(31) { left: 55%; font-size: 13px; animation-duration: 13s; animation-delay: -12s; opacity:.7; }
.snowfall span:nth-child(32) { left: 60%; font-size: 18px; animation-duration: 16s; animation-delay: -5s;  opacity:.9; }
.snowfall span:nth-child(33) { left: 65%; font-size: 11px; animation-duration: 11s; animation-delay: -9s;  opacity:.6; }
.snowfall span:nth-child(34) { left: 70%; font-size: 17px; animation-duration: 18s; animation-delay: -2s;  opacity:.85;}
.snowfall span:nth-child(35) { left: 75%; font-size: 10px; animation-duration: 14s; animation-delay: -6s;  opacity:.65;}
.snowfall span:nth-child(36) { left: 80%; font-size: 14px; animation-duration: 12s; animation-delay: -10s; opacity:.75;}
.snowfall span:nth-child(37) { left: 85%; font-size: 19px; animation-duration: 17s; animation-delay: -4s;  opacity:.95;}
.snowfall span:nth-child(38) { left: 90%; font-size: 13px; animation-duration: 15s; animation-delay: -7s;  opacity:.7; }
.snowfall span:nth-child(39) { left: 95%; font-size: 16px; animation-duration: 10s; animation-delay: -13s; opacity:.8; }
.snowfall span:nth-child(40) { left: 99%; font-size: 11px; animation-duration: 19s; animation-delay: -3s;  opacity:.65;}

@keyframes snowFall {
  0%   { transform: translate3d(0,   0,         0) rotate(0deg);    opacity: 0;   }
  6%   {                                                            opacity: 1;   }
  50%  { transform: translate3d(18px,55vh,      0) rotate(180deg);  }
  94%  {                                                            opacity: 1;   }
  100% { transform: translate3d(-12px, 110vh,   0) rotate(360deg);  opacity: 0;   }
}

/* Tone snow down for light theme so the bright background isn't too busy */
body.theme-light .snowfall span { color: #ffffff; text-shadow: 0 0 6px rgba(255,255,255,.95), 0 1px 3px rgba(20,40,80,.3); opacity: .85; }

/* ---------- Page layout ---------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(60px, 12vh, 140px) 16px 110px;
  position: relative;
  z-index: 1;
}
.hero {
  width: min(880px, 100%);
  display: flex; flex-direction: column; align-items: center;
  gap: 28px;
  text-align: center;
}

/* ---------- Avatar ---------- */
.avatar-wrap {
  position: relative;
  width: clamp(120px, 18vw, 160px);
  height: clamp(120px, 18vw, 160px);
  border-radius: 50%;
  transition: transform .5s cubic-bezier(.22,1,.36,1);
}
.avatar-wrap:hover { transform: translateY(-6px) scale(1.02); }
.avatar-wrap .avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative; z-index: 2;
  box-shadow:
    0 0 0 4px rgba(255,255,255,.08),
    0 0 0 8px rgba(122,109,255,.16),
    0 22px 60px rgba(0,5,30,.6);
}
.avatar-wrap .ping {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: .35;
  animation: ping 2.6s ease-out infinite;
}
.avatar-wrap .ping-b { animation-delay: .8s;  background: radial-gradient(circle, var(--primary-2) 0%, transparent 70%); }
.avatar-wrap .ping-c { animation-delay: 1.6s; background: radial-gradient(circle, var(--accent) 0%, transparent 70%); }
@keyframes ping {
  0%   { transform: scale(.85); opacity: .55; }
  80%  { transform: scale(1.6); opacity: 0;   }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* ---------- Quotes ---------- */
.quotes {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 760px;
  padding: 0 8px;
}
.quote {
  margin: 0;
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.7;
  color: #f6f9ff;
  text-shadow: 0 2px 14px rgba(0,0,0,.7), 0 0 28px rgba(0,0,0,.45), 0 0 6px rgba(0,0,0,.6);
  position: relative;
  min-height: 1.7em;
  font-weight: 500;
}
body.theme-light .quote {
  color: #0a1633;
  font-weight: 600;
  text-shadow:
    0 1px 0 rgba(255,255,255,.85),
    0 0 12px rgba(255,255,255,.95),
    0 0 28px rgba(255,255,255,.7);
}
.quote .caret {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--primary);
  vertical-align: -2px;
  margin-left: 2px;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ---------- Hero icons (Telegram + Music) ---------- */
.hero-icons {
  display: flex; gap: 22px;
  align-items: center; justify-content: center;
}
.hero-icon {
  position: relative;
  width: 54px; height: 54px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 26px rgba(0,8,30,.45), inset 0 0 0 1px rgba(255,255,255,.04);
  transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s;
  overflow: visible;
}
.hero-icon:hover { transform: translateY(-3px) scale(1.06); }
.hero-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.hero-icon .ring {
  position: absolute; inset: -7px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  opacity: 0;
  animation: rotateRing 4s linear infinite;
}
.hero-icon:hover .ring { opacity: 1; }
@keyframes rotateRing { to { transform: rotate(360deg); } }

/* Music button specifics */
.hero-icon--music {
  padding: 0;
  overflow: visible;
  color: #fff;
  border: 2px solid rgba(255,255,255,.25);
  isolation: isolate;
}
.hero-icon--music::before {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), var(--primary-2), var(--accent), var(--primary));
  z-index: -1;
  opacity: 0;
  filter: blur(8px);
  transition: opacity .4s;
}
.hero-icon--music.is-playing::before { opacity: .9; animation: spin 5s linear infinite; }
.hero-icon--music .music-art {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  transition: transform 8s linear, filter .35s;
}
.hero-icon--music.is-playing .music-art {
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-icon--music .pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  pointer-events: none;
}
.hero-icon--music.is-playing .pulse-a { animation: musicPulse 1.8s ease-out infinite; }
.hero-icon--music.is-playing .pulse-b { animation: musicPulse 1.8s ease-out infinite .6s; }
.hero-icon--music.is-playing .pulse-c { animation: musicPulse 1.8s ease-out infinite 1.2s; }
@keyframes musicPulse {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(1.9); opacity: 0;   }
}

/* Waveform inside (visible when playing) */
.hero-icon--music .waveform {
  position: absolute; bottom: -22px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 3px; align-items: flex-end;
  height: 16px;
  opacity: 0;
  transition: opacity .3s;
}
.hero-icon--music.is-playing .waveform { opacity: 1; }
.hero-icon--music .waveform i {
  display: block; width: 3px; border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  height: 6px;
  animation: wave 1s ease-in-out infinite;
}
.hero-icon--music .waveform i:nth-child(2) { animation-delay: .15s; }
.hero-icon--music .waveform i:nth-child(3) { animation-delay: .30s; }
.hero-icon--music .waveform i:nth-child(4) { animation-delay: .45s; }
@keyframes wave {
  0%, 100% { height: 4px; }
  50%      { height: 16px; }
}

/* Paused overlay */
.hero-icon--music .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,5,20,.55);
  border-radius: 50%;
  color: #fff;
  opacity: 1;
  transition: opacity .25s;
}
.hero-icon--music.is-playing .play-overlay { opacity: 0; }

/* ---------- Tooltip (data-tip-zh/en used) ---------- */
.tooltip {
  position: fixed;
  z-index: 100;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(0,5,20,.85);
  color: #fff;
  border: 1px solid var(--glass-edge);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .15s, transform .15s;
  white-space: nowrap;
}
.tooltip.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Cards ---------- */
.cards {
  margin-top: 18px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 0 4px;
}
.card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  text-align: left;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  box-shadow: var(--shadow);
  color: var(--fg);
  transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s, border-color .35s, background .35s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .8s ease;
  pointer-events: none;
}
.card:hover::before { transform: translateX(100%); }
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 18px 50px rgba(0,8,30,.6);
}
.card .card-art {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 20px rgba(92,200,255,.35);
}
.card .card-art img {
  width: 100%; height: 100%; object-fit: cover;
}
.card .card-art--site,
.card .card-art--dl { background: linear-gradient(135deg, var(--primary-2), var(--accent)); }
.card .card-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.card .card-text strong { font-weight: 600; font-size: 15px; }
.card .card-text small  { color: var(--fg-mute); font-size: 12.5px; }
.card .card-ext { color: var(--fg-mute); font-size: 16px; transition: transform .35s, color .35s; }
.card:hover .card-ext { color: var(--primary); transform: translateX(3px) translateY(-3px); }
/* ---------- Footer ---------- */
.site-footer {
  position: fixed; bottom: 12px; left: 50%;
  transform: translateX(-50%);
  font-size: 12.5px;
  color: var(--fg-mute);
  z-index: 1;
}
.site-footer a:hover { color: var(--fg); }

/* ---------- Settings panel (bottom-right) ---------- */
.settings {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 10px;
}
.settings-toggle {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--fg-soft);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: transform .35s, color .35s;
}
.settings-toggle:hover { color: var(--fg); transform: rotate(45deg); }
.settings[data-open="true"] .settings-toggle { color: var(--primary); transform: rotate(120deg); }

.settings-panel {
  display: flex; flex-direction: column;
  width: 230px;
  padding: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: var(--shadow);
  transform-origin: bottom right;
  transform: scale(.85) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .25s;
}
.settings[data-open="true"] .settings-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.setting-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
  transition: background .2s;
  text-align: left;
}
.setting-row:hover { background: var(--glass-2); }
.setting-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.setting-icon .ico-sun  { display: none; }
body.theme-light .setting-icon .ico-sun { display: block; }
body.theme-light .setting-icon .ico-moon { display: none; }
.setting-label { flex: 1; }
.setting-value {
  font-size: 12.5px;
  color: var(--fg-mute);
  padding: 3px 8px;
  background: var(--glass-2);
  border-radius: 8px;
}
.setting-toggle {
  width: 36px; height: 20px;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  position: relative;
  transition: background .3s;
}
.setting-toggle .dot {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: transform .3s;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
}
body[data-music="on"] .setting-toggle { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
body[data-music="on"] .setting-toggle .dot { transform: translateX(16px); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; animation: modalFade .25s ease-out; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2,5,15,.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 60px rgba(0,8,30,.6);
  color: var(--fg);
  animation: modalRise .35s cubic-bezier(.22,1,.36,1);
}
@keyframes modalRise {
  from { transform: translateY(14px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1);     opacity: 1; }
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  font-size: 14px; color: var(--fg-mute);
  width: 28px; height: 28px; border-radius: 50%;
  transition: color .2s, background .2s;
}
.modal-close:hover { background: var(--glass-2); color: var(--fg); }
.modal-head {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 14px;
}
.modal-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 28px rgba(92,200,255,.4);
}
.modal-head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.modal-sub    { margin: 0; font-size: 12.5px; color: var(--fg-mute); }
.modal-sub b  { color: var(--fg-soft); }
.changelog {
  list-style: none; padding: 12px 14px; margin: 14px 0;
  background: var(--glass-2);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--fg-soft);
}
.changelog li { padding: 3px 0 3px 18px; position: relative; }
.changelog li::before {
  content: "✦"; position: absolute; left: 0; top: 2px;
  color: var(--primary);
  font-size: 12px;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 4px;
}
.btn {
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn-ghost {
  background: var(--glass-2);
  color: var(--fg-soft);
}
.btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--fg); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(92,200,255,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(92,200,255,.5); }

.modal-progress { margin-top: 14px; }
.modal-progress .bar {
  width: 100%; height: 8px;
  background: var(--glass-2);
  border-radius: 999px;
  overflow: hidden;
}
.modal-progress .bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent));
  background-size: 200% 100%;
  animation: gradMove 1.6s linear infinite;
  transition: width .3s ease;
}
@keyframes gradMove { to { background-position: 200% 0; } }
.progress-text { font-size: 12.5px; color: var(--fg-mute); margin: 8px 0 0; text-align: center; }

/* ---------- Entrance animations ---------- */
[data-anim] { opacity: 0; transform: translateY(20px); animation: rise .9s cubic-bezier(.22,1,.36,1) forwards; }
[data-anim="fade-down"] { transform: translateY(-30px); }
[data-anim="fade-up"]   { transform: translateY(30px);  }
.avatar-wrap[data-anim] { animation-delay: .05s; }
.quotes[data-anim]      { animation-delay: .25s; }
.hero-icons[data-anim]  { animation-delay: .45s; }
.cards[data-anim]       { animation-delay: .65s; }
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .page { padding-top: 70px; padding-bottom: 160px; }
  .quote { font-size: 14.5px; padding: 0 6px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .hero-icon { width: 50px; height: 50px; }
  .settings { bottom: 14px; right: 14px; }
  .settings-panel { width: 220px; }
  .site-footer { position: static; transform: none; margin-top: 28px; padding-bottom: 8px; }
  .page { padding-bottom: 80px; }
}
@media (max-width: 380px) {
  .page { padding-top: 50px; }
  .hero { gap: 22px; }
}

/* ==========================================================================
   Image Gallery — premium wallpaper-style masonry grid + lightbox
   ========================================================================== */

/* Gallery nav card variant */
.card--gallery .card-art--gallery {
  background: linear-gradient(135deg, #ff7eb3, #6dd5ed, #7a6dff);
  color: #fff;
  box-shadow: 0 8px 22px rgba(122,109,255,.35);
}
.card--gallery:hover .card-art--gallery { box-shadow: 0 12px 30px rgba(255,126,179,.45); }

/* Hide hero when gallery is open */
.hero[hidden], .gallery-view[hidden] { display: none !important; }
.gallery-view {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 0 4px;
  animation: gvIn .45s cubic-bezier(.22,1,.36,1);
}
@keyframes gvIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* Header */
.gallery-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 4px 6px 22px;
  margin-bottom: 8px;
}
.gallery-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--fg);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform .25s, color .25s;
  cursor: pointer;
}
.gallery-back:hover { transform: translateX(-2px); color: var(--primary); }
.gallery-title-wrap { text-align: center; }
.gallery-title {
  margin: 0; font-size: clamp(22px, 3vw, 28px); font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0,0,0,.55), 0 0 28px rgba(0,0,0,.35);
}
body.theme-light .gallery-title {
  color: #0a1633;
  text-shadow: 0 1px 0 rgba(255,255,255,.85), 0 0 12px rgba(255,255,255,.9);
}
.gallery-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--fg-mute); }
.gallery-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.gallery-search {
  position: relative;
  display: inline-flex; align-items: center;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: 12px;
  padding: 6px 10px 6px 32px;
  box-shadow: var(--shadow);
  transition: box-shadow .25s, border-color .25s;
}
.gallery-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(92,200,255,.18), var(--shadow); }
.gallery-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-mute); }
.gallery-search input {
  background: transparent; border: 0; outline: 0;
  color: var(--fg); font: inherit; font-size: 13.5px;
  width: 180px;
}
.gallery-search input::placeholder { color: var(--fg-mute); }

.gallery-filters { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  font-size: 12.5px; font-weight: 600;
  border-radius: 999px;
  color: var(--fg-soft);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: color .2s, background .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
}
.chip:hover { color: var(--fg); transform: translateY(-1px); }
.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(92,200,255,.4);
}

/* Masonry grid via CSS columns */
.gallery-grid {
  column-count: 4;
  column-gap: 14px;
  padding: 0 2px 60px;
}
@media (max-width: 1100px) { .gallery-grid { column-count: 3; } }
@media (max-width: 760px)  { .gallery-grid { column-count: 2; column-gap: 10px; } }
@media (max-width: 420px)  { .gallery-grid { column-count: 1; } }

.tile {
  display: block;
  position: relative;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  break-inside: avoid;
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(8px) saturate(130%);
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  box-shadow: 0 10px 30px rgba(0,8,30,.5);
  transition: transform .45s cubic-bezier(.22,1,.36,1), box-shadow .45s, border-color .35s;
  isolation: isolate;
  font: inherit;
  color: inherit;
  text-align: left;
}
@media (max-width: 760px) { .tile { margin: 0 0 10px; border-radius: 14px; } }
.tile::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,5,20,.65) 100%);
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
}
.tile:hover { transform: translateY(-4px); box-shadow: 0 22px 50px rgba(0,8,30,.62); border-color: rgba(255,255,255,.28); }
.tile:hover::after { opacity: 1; }
.tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.tile .tile-aspect {
  position: relative;
  width: 100%;
  background: linear-gradient(110deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.04) 70%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}
@keyframes skeleton { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.tile img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .55s ease-out, transform 1.2s cubic-bezier(.22,1,.36,1);
}
.tile img.loaded { opacity: 1; transform: scale(1); }
.tile.loaded .tile-aspect { animation: none; background: transparent; }
.tile:hover img.loaded { transform: scale(1.04); }

.tile .tile-caption {
  position: absolute;
  left: 12px; right: 12px; bottom: 10px;
  z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s, transform .35s;
  pointer-events: none;
}
.tile:hover .tile-caption,
.tile:focus-visible .tile-caption { opacity: 1; transform: translateY(0); }
.tile .tile-caption strong { font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.tile .tile-tag {
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tile .tile-corner {
  position: absolute; top: 10px; right: 10px;
  z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,5,20,.55);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .3s, transform .3s, background .25s;
  text-decoration: none;
}
.tile:hover .tile-corner { opacity: 1; transform: scale(1); }
.tile .tile-corner:hover { background: var(--primary); }

.gallery-empty { text-align: center; color: var(--fg-mute); padding: 40px 10px 80px; font-size: 14px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  z-index: 110;
  display: none;
  background: rgba(2,4,12,.88);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: lbFade .25s ease-out;
  overscroll-behavior: contain;
}
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
.lightbox.show { display: block; }
.lightbox-backdrop { position: absolute; inset: 0; cursor: zoom-out; }
.lightbox-stage {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 70px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.lightbox-img {
  max-width: 92%;
  max-height: 100%;
  width: auto; height: auto;
  border-radius: 6px;
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  user-select: none;
  cursor: zoom-in;
  transform-origin: center center;
  transition: opacity .3s;
  opacity: 0;
  will-change: transform;
}
.lightbox-img.loaded { opacity: 1; animation: lbRise .4s cubic-bezier(.22,1,.36,1); }
.lightbox-img.grabbing { cursor: grabbing; }
@keyframes lbRise { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lightbox-spinner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: inline-flex; gap: 6px;
  pointer-events: none;
}
.lightbox-spinner i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.lightbox-spinner i:nth-child(2) { animation-delay: .2s; }
.lightbox-spinner i:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.lb-btn {
  position: absolute;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  transition: background .25s, transform .25s;
  z-index: 5;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-prev  { top: 50%; left: 18px;  transform: translateY(-50%); }
.lb-next  { top: 50%; right: 18px; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) scale(1.05); }
.lb-next:hover { transform: translateY(-50%) scale(1.05); }
.lb-close { top: 18px; right: 18px; }

.lightbox-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.6) 100%);
  color: #fff;
  z-index: 4;
}
.lb-meta { display: flex; flex-direction: column; min-width: 0; }
.lb-meta strong { font-size: 15px; font-weight: 600; }
.lb-info { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 2px; }

.lb-zoom {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lb-zoom-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background .2s;
  cursor: pointer;
}
.lb-zoom-btn:hover { background: rgba(255,255,255,.18); }
.lb-zoom-val { font-size: 12px; min-width: 38px; text-align: center; color: rgba(255,255,255,.85); }

.lb-download {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  padding: 9px 16px;
  font-size: 13.5px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .lightbox-stage { bottom: 130px; }
  .lb-prev { left: 10px;  }
  .lb-next { right: 10px; }
  .lb-btn  { width: 40px; height: 40px; }
  .lightbox-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px 14px; }
  .lb-meta { align-items: center; text-align: center; }
  .lb-zoom { align-self: center; }
  .lb-download { justify-content: center; }
  .gallery-tools { width: 100%; justify-content: center; }
  .gallery-search input { width: 100%; }
  .gallery-head { grid-template-columns: auto 1fr; grid-template-areas: "back title" "tools tools"; gap: 12px; }
  .gallery-back  { grid-area: back; }
  .gallery-title-wrap { grid-area: title; text-align: left; }
  .gallery-tools { grid-area: tools; }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .bg-img { animation: none; }
  .bg-particles, .snowfall { display: none; }
  .tile-aspect { animation: none !important; background: transparent !important; }
}


/* ==========================================================================
   === DazhiMh v5 — premium polish (additive) ===========================
   ========================================================================== */


/* --- Issue #5: Aurora wave/glow around the hero avatar -------------------- */
.avatar-wrap.avatar-wrap--aurora { isolation: isolate; }
.avatar-wrap.avatar-wrap--aurora::before,
.avatar-wrap.avatar-wrap--aurora::after {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: conic-gradient(from 0deg,
    rgba(92,200,255,.55), rgba(122,109,255,.55),
    rgba(255,107,214,.55), rgba(92,200,255,.55));
  filter: blur(18px);
  opacity: .55;
  animation: auroraSpin 9s linear infinite;
}
.avatar-wrap.avatar-wrap--aurora::after {
  inset: -34px;
  filter: blur(28px);
  opacity: .38;
  animation-duration: 14s;
  animation-direction: reverse;
}
@keyframes auroraSpin { to { transform: rotate(360deg); } }
body.theme-light .avatar-wrap.avatar-wrap--aurora::before { opacity: .42; }
body.theme-light .avatar-wrap.avatar-wrap--aurora::after  { opacity: .26; }

/* Subtle dynamic effect around Telegram hero icon (matches avatar aurora) */
.hero-icon.hero-icon--aurora { isolation: isolate; }
.hero-icon.hero-icon--aurora::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  background: conic-gradient(from 0deg,
    rgba(92,200,255,.55), rgba(122,109,255,.0),
    rgba(92,200,255,.55), rgba(122,109,255,.0));
  filter: blur(7px);
  opacity: 0;
  animation: auroraSpin 6s linear infinite;
  transition: opacity .4s;
}
.hero-icon.hero-icon--aurora:hover::after { opacity: .85; }
/* Soft idle pulse on Telegram icon (very subtle) */
.hero-icon.hero-icon--aurora::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(92,200,255,.45);
  animation: tgIdlePulse 3.4s ease-out infinite;
}
@keyframes tgIdlePulse {
  0%   { box-shadow: 0 0 0 0 rgba(92,200,255,.55); }
  70%  { box-shadow: 0 0 0 14px rgba(92,200,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(92,200,255,0); }
}

/* --- Issue #6 (subtle premium polish): soft glass reflection + shimmer on cards
       Reuses existing .card::before swipe; we ADD a static specular highlight. */
.card { position: relative; }
.card .card-glass {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 55%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.10) 0%, transparent 100%);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  opacity: .65;
}
/* Slight 3D tilt on desktop cards only (touch devices unaffected) */
@media (hover: hover) and (min-width: 769px) {
  .card { transform-style: preserve-3d; }
  .card:hover {
    transform: translateY(-4px) perspective(800px) rotateX(2deg) rotateY(-2deg);
  }
}


/* Performance / accessibility */
@media (prefers-reduced-motion: reduce) {
  .avatar-wrap.avatar-wrap--aurora::before,
  .avatar-wrap.avatar-wrap--aurora::after,
  .hero-icon.hero-icon--aurora::before,
  .hero-icon.hero-icon--aurora::after,

   { animation: none !important; }
}


/* === DazhiMh v6 — Gallery polish === */
/* Smooth fade when categories / search filter changes */
.gallery-grid {
  transition: opacity .22s ease, transform .28s ease;
  will-change: opacity, transform;
}
.gallery-grid.is-switching {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

/* Tile entrance — staggered fade up so filtered results feel fluid */
.gallery-grid .tile {
  animation: galleryTileIn .42s cubic-bezier(.22,1,.36,1) both;
}
.gallery-grid .tile:nth-child(1)  { animation-delay: .02s; }
.gallery-grid .tile:nth-child(2)  { animation-delay: .06s; }
.gallery-grid .tile:nth-child(3)  { animation-delay: .10s; }
.gallery-grid .tile:nth-child(4)  { animation-delay: .14s; }
.gallery-grid .tile:nth-child(5)  { animation-delay: .18s; }
.gallery-grid .tile:nth-child(6)  { animation-delay: .22s; }
.gallery-grid .tile:nth-child(7)  { animation-delay: .24s; }
.gallery-grid .tile:nth-child(8)  { animation-delay: .26s; }
.gallery-grid .tile:nth-child(n+9){ animation-delay: .28s; }
@keyframes galleryTileIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chip active state — gentle press feedback */
.chip { transition: color .2s, background .2s, transform .15s, box-shadow .25s, border-color .2s; }
.chip:active { transform: translateY(0) scale(.97); }
.chip.is-active { animation: chipPop .35s cubic-bezier(.22,1,.36,1); }
@keyframes chipPop {
  0%   { transform: translateY(-1px) scale(.96); }
  60%  { transform: translateY(-2px) scale(1.04); }
  100% { transform: translateY(-1px) scale(1); }
}

/* Polished "no images found" empty state */
.gallery-empty[hidden] { display: none !important; }
.gallery-empty {
  display: block;
  margin: 30px auto 80px;
  padding: 34px 22px;
  max-width: 380px;
  text-align: center;
  color: var(--fg-soft);
  font-size: 14.5px;
  font-weight: 500;
  background: var(--glass);
  border: 1px dashed var(--glass-edge);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
  animation: emptyRise .35s cubic-bezier(.22,1,.36,1);
}
.gallery-empty::before {
  content: "🔍";
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
  opacity: .8;
}
@keyframes emptyRise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile spacing polish */
@media (max-width: 640px) {
  .gallery-grid { padding-bottom: 40px; }
  .gallery-empty { margin: 20px auto 60px; padding: 26px 18px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gallery-grid, .gallery-grid.is-switching { transition: none; transform: none; }
  .gallery-grid .tile { animation: none; }
  .chip.is-active { animation: none; }
  .gallery-empty { animation: none; }
}


/* === DazhiMh v7 — Smart Adaptive Gallery === */
/* Replace column-masonry with a smart CSS Grid that respects each
   image's intrinsic aspect ratio via per-tile gridRowEnd computed in JS.
   This way portraits stay tall, landscapes stay wide — no awkward cropping. */
.gallery-grid {
  column-count: initial;
  column-gap: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 10px;
  gap: 14px;
  padding: 0 2px 60px;
}
@media (min-width: 1280px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
}
@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: 8px;
    gap: 10px;
  }
}
@media (max-width: 420px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Re-style tiles to fill their grid cell exactly, preserving aspect via
   .tile-aspect height already set by paddingBottom. */
.tile {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.tile .tile-aspect {
  flex: 1;
  height: 100%;
}
/* Smart object-fit: prefer cover but tighten/loosen by orientation */
.tile--portrait img,
.tile--square img {
  object-fit: cover;
  object-position: center 20%;   /* faces tend to be upper-third */
}
.tile--landscape img {
  object-fit: cover;
  object-position: center center;
}
.tile:hover img.loaded { transform: scale(1.04); }

/* Tile tag chip: align right, smaller, anime tone */
.tile .tile-tag {
  background: rgba(122,109,255,.28);
  border: 1px solid rgba(255,255,255,.18);
}

/* Filter chip overflow: allow horizontal scroll on narrow viewports */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
@media (max-width: 760px) {
  .gallery-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px;
  }
  .gallery-filters::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}




/* === DazhiMh v10b — math-correct responsive hero background positioning === */
/* Mobile portrait (default, UNCHANGED per user requirement — face appears in upper-mid area) */
.bg-img { object-position: 50% 38%; }

/* Mobile landscape — face high in viewport */
@media (max-width: 820px) and (orientation: landscape) {
  .bg-img { object-position: 50% 49%; }
}

/* Tablet portrait — keep mobile-style framing */
@media (min-width: 641px) and (max-width: 820px) and (orientation: portrait) {
  .bg-img { object-position: 50% 38%; }
}

/* Tablet landscape & small laptops — face well into upper area */
@media (min-width: 821px) and (max-width: 1100px) {
  .bg-img { object-position: 50% 60%; }
}

/* Laptop & standard desktop — face appears above hero quotes */
@media (min-width: 1101px) and (max-width: 1600px) {
  .bg-img { object-position: 50% 55%; }
}

/* Wide / ultrawide desktop — face high so above avatar */
@media (min-width: 1601px) {
  .bg-img { object-position: 50% 50%; }
}


/* === DazhiMh v11 — smart thumbnail focal cropping === */
.tile img { object-fit: cover; object-position: 50% 25%; }
.tile--portrait img  { object-position: 50% 18%; }
.tile--square img    { object-position: 50% 28%; }
.tile--landscape img { object-position: 50% 32%; }
.card-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
