:root {
  color-scheme: dark;
  --bg-overlay: rgba(10, 18, 30, 0.46);
  --card-bg: rgba(203, 220, 255, 0.16);
  --card-border: rgba(255, 255, 255, 0.22);
  --card-shadow: 0 24px 60px rgba(7, 14, 24, 0.34);
  --text-main: #f5f7fb;
  --text-muted: rgba(231, 236, 246, 0.82);
  --text-soft: rgba(231, 236, 246, 0.62);
  --accent: #a7d4ff;
  --accent-strong: #d7ebff;
  --sidebar-width: 260px;
  --rightbar-width: 280px;
  --dash-max-w: 1600px;
  /* ── Animation tokens ── */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --duration-fast: 160ms;
  --duration-normal: 240ms;
  --duration-slow: 300ms;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--text-main);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 36%),
    linear-gradient(135deg, rgba(10, 18, 28, 0.3), rgba(14, 31, 52, 0.72)),
    url("image/back.png") center / cover no-repeat fixed;
  position: relative;
  overflow-x: hidden;
}

/* ─── Dashboard Shell ─── */

.dash-shell {
  position: relative;
  z-index: 1;
  width: min(var(--dash-max-w), calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.dash-shell::before {
  content: "";
  position: absolute;
  left: calc(var(--sidebar-width) + 16px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* ─── Left Sidebar ─── */

.dash-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 40px;
  padding-right: 24px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(198, 230, 255, 0.34), rgba(89, 116, 152, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.sidebar-avatar img,
.avatar-fallback {
  width: 100%;
  height: 100%;
}

.sidebar-avatar img {
  display: block;
  object-fit: cover;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 5rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.sidebar-avatar {
  position: relative;
}

#avatarFrame.is-fallback img {
  opacity: 0;
}

#avatarFrame.is-fallback .avatar-fallback {
  opacity: 1;
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--text-soft);
  text-transform: uppercase;
}

.sidebar-name {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-bio {
  margin: 0;
  font-size: 0.92rem;
  color: var(--accent-strong);
}

.sidebar-desc {
  margin: 14px 0 0;
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.sidebar-quote {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-quote-text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.8;
  font-weight: 500;
  color: var(--text-muted);
  font-style: normal;
}

.sidebar-quote-source {
  display: block;
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--text-soft);
  font-style: normal;
  text-align: right;
}

/* ─── Main Content ─── */

.dash-main {
  flex: 1;
  min-width: 0;
}

.dash-hero {
  padding: 0;
}

.dash-hero .eyebrow {
  margin-bottom: 8px;
}

.dash-hero-title {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.15;
  font-weight: 700;
}

.dash-hero-title span {
  color: var(--accent-strong);
  text-shadow: 0 0 22px rgba(200, 228, 255, 0.28);
}

.dash-hero-text {
  margin: 16px 0 0;
  font-size: 1.06rem;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 620px;
}

.dash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(186, 224, 255, 0.32), rgba(123, 176, 219, 0.26));
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
  will-change: transform;
}

.primary-button:active {
  transform: scale(0.97);
}

.primary-button:hover {
  box-shadow: 0 12px 30px rgba(102, 155, 214, 0.24);
  background: linear-gradient(135deg, rgba(201, 232, 255, 0.42), rgba(126, 184, 231, 0.32));
}

@media (hover: hover) and (pointer: fine) {
  .primary-button:hover {
    transform: translateY(-2px);
  }
}

.dash-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 36px 0;
}

.dash-project {
  cursor: pointer;
}

.dash-project .section-label {
  margin-bottom: 6px;
}

.dash-project-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.dash-project-subtitle {
  margin: 14px 0 12px;
  font-size: 1.1rem;
  color: var(--accent-strong);
}

.dash-project-desc {
  margin: 0;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text-muted);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.tag-group span {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* ─── Right Sidebar ─── */

.dash-rightbar {
  width: var(--rightbar-width);
  flex-shrink: 0;
  position: sticky;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-right: 2px;
}

.glass-card {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(131, 158, 205, 0.08));
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
  will-change: transform;
}

.glass-card:hover {
  box-shadow: 0 18px 38px rgba(102, 155, 214, 0.24);
  background: linear-gradient(135deg, rgba(201, 232, 255, 0.26), rgba(126, 184, 231, 0.2));
  border-color: rgba(218, 236, 255, 0.32);
}

@media (hover: hover) and (pointer: fine) {
  .glass-card:hover {
    transform: translateY(-4px);
  }
}

.violet-glow::before {
  content: "";
  position: absolute;
  inset: auto 14% -12% 14%;
  height: 34%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(178, 144, 255, 0.22) 0, rgba(178, 144, 255, 0.12) 42%, transparent 74%);
  filter: blur(26px);
  z-index: -1;
  pointer-events: none;
}

.dash-card {
  border-radius: 24px;
  padding: 24px;
}

.dash-card-clickable {
  cursor: pointer;
}

.card-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--text-main);
}

.calendar-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: center;
  margin-top: 18px;
}

.calendar-month {
  grid-column: 1 / -1;
  font-size: 0.92rem;
  color: var(--accent-strong);
  letter-spacing: 0.14em;
}

.calendar-day {
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  line-height: 1;
  font-weight: 700;
}

.calendar-meta p {
  margin: 2px 0;
  line-height: 1.6;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.countdown-number {
  margin-top: 18px;
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  line-height: 1;
  font-weight: 700;
  color: var(--accent-strong);
}

.countdown-unit {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.countdown-footnote {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.md-note-description {
  margin: 16px 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.8;
}

/* ─── Responsive ─── */

@media (max-width: 960px) {
  .dash-shell {
    flex-direction: column;
    width: min(100% - 32px, var(--dash-max-w));
    gap: 24px;
  }

  .dash-sidebar,
  .dash-rightbar {
    width: 100%;
    position: static;
  }

  .dash-sidebar {
    padding-right: 0;
    border-right: none;
  }

  .dash-shell::before {
    display: none;
  }

  .sidebar-avatar {
    width: 120px;
    aspect-ratio: 1;
    margin-bottom: 16px;
  }

  .dash-hero-title {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
  }
}

@media (max-width: 640px) {
  .dash-shell {
    padding: 24px 0 40px;
    gap: 20px;
  }

  .sidebar-avatar {
    width: 96px;
  }

  .dash-card {
    padding: 20px;
  }

  .dash-divider {
    margin: 28px 0;
  }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  .primary-button:hover,
  .glass-card:hover {
    transform: none !important;
  }
}
