:root {
  color-scheme: light;
  --page: #edf4ea;
  --surface: rgba(255, 253, 244, 0.94);
  --surface-muted: rgba(232, 239, 220, 0.88);
  --veil: rgba(255, 253, 244, 0.68);
  --ink: #233b3d;
  --muted: #667876;
  --line: rgba(68, 104, 102, 0.26);
  --sky: #a9cfdd;
  --sky-deep: #6fa6bf;
  --accent-text: #4f8494;
  --cloud: #fff8e8;
  --dress: #f7f2df;
  --grass: #85a867;
  --grass-deep: #587a4e;
  --violet: #8d8ab8;
  --peach: #e5a47c;
  --button-start: #4f8798;
  --button-end: #587a4e;
  --button-hover-start: #4e759c;
  --button-hover-end: #bd765f;
  --button-text: #fffaf0;
  --chart-bar-fill: color-mix(in srgb, var(--sky-deep) 58%, var(--grass));
  --heat-1: #d9efe7;
  --heat-2: #9fd3c5;
  --heat-3: #58aaa4;
  --heat-4: #2d7d8f;
  --shadow: 0 24px 60px rgba(49, 82, 80, 0.18);
  --lift-shadow: 0 16px 42px rgba(45, 77, 75, 0.14);
  --radius: 8px;
  --max-width: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #162b30;
  --surface: rgba(26, 47, 52, 0.92);
  --surface-muted: rgba(37, 65, 64, 0.9);
  --veil: rgba(18, 35, 40, 0.72);
  --ink: #f7f1df;
  --muted: #c4d1ca;
  --line: rgba(213, 226, 213, 0.24);
  --sky: #75a9be;
  --sky-deep: #9fd5e2;
  --accent-text: #a9dbe8;
  --cloud: #f4ebd5;
  --dress: #f5ecd5;
  --grass: #8fb27c;
  --grass-deep: #53735b;
  --violet: #aaa7d2;
  --peach: #eead82;
  --button-start: #3f8190;
  --button-end: #4f7350;
  --button-hover-start: #5a82aa;
  --button-hover-end: #a96858;
  --button-text: #fffaf0;
  --heat-1: #315b5c;
  --heat-2: #4f8782;
  --heat-3: #78b7a6;
  --heat-4: #a5dac4;
  --shadow: 0 26px 62px rgba(0, 0, 0, 0.34);
  --lift-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(190, 219, 228, 0.86) 0 32%, rgba(232, 239, 220, 0.74) 46%, rgba(132, 168, 103, 0.62) 100%),
    radial-gradient(ellipse at 18% 14%, rgba(255, 248, 232, 0.36) 0 18%, transparent 42%),
    linear-gradient(135deg, rgba(111, 166, 191, 0.14), transparent 56%),
    linear-gradient(24deg, transparent 42%, rgba(133, 168, 103, 0.18) 58%, transparent 78%),
    var(--page);
  background-attachment: fixed;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  line-height: 1.65;
}

[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(24, 52, 61, 0.94) 0 34%, rgba(31, 61, 57, 0.88) 54%, rgba(27, 48, 39, 0.96) 100%),
    radial-gradient(ellipse at 22% 16%, rgba(159, 213, 226, 0.12) 0 18%, transparent 44%),
    linear-gradient(137deg, rgba(159, 213, 226, 0.08), transparent 58%),
    linear-gradient(24deg, transparent 40%, rgba(143, 178, 124, 0.12) 62%, transparent 82%),
    var(--page);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(ellipse 72% 24% at 18% 16%, rgba(255, 248, 232, 0.42), transparent 64%),
    radial-gradient(ellipse 62% 18% at 70% 20%, rgba(247, 242, 223, 0.28), transparent 66%),
    linear-gradient(12deg, transparent 44%, rgba(88, 122, 78, 0.2) 68%, transparent 88%),
    linear-gradient(7deg, transparent 54%, rgba(133, 168, 103, 0.24) 76%, transparent 100%),
    linear-gradient(112deg, rgba(255, 253, 244, 0.12), transparent 50%),
    linear-gradient(165deg, transparent 28%, rgba(141, 138, 184, 0.08), transparent 78%);
  filter: saturate(1.08);
  mix-blend-mode: multiply;
}

body::after {
  background:
    linear-gradient(90deg, transparent 0 7%, var(--veil) 18%, color-mix(in srgb, var(--veil) 56%, transparent) 50%, var(--veil) 82%, transparent 96%),
    linear-gradient(3deg, transparent 0 34%, rgba(255, 253, 244, 0.16) 54%, transparent 78%);
  opacity: 0.88;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 72% 24% at 18% 16%, rgba(159, 213, 226, 0.12), transparent 64%),
    radial-gradient(ellipse 62% 18% at 70% 20%, rgba(245, 236, 213, 0.08), transparent 66%),
    linear-gradient(12deg, transparent 44%, rgba(83, 115, 91, 0.18) 68%, transparent 88%),
    linear-gradient(7deg, transparent 54%, rgba(143, 178, 124, 0.12) 76%, transparent 100%),
    linear-gradient(112deg, rgba(169, 219, 232, 0.04), transparent 50%),
    linear-gradient(165deg, transparent 28%, rgba(170, 167, 210, 0.05), transparent 78%);
  mix-blend-mode: screen;
  opacity: 0.5;
}

[data-theme="dark"] body::after {
  background:
    linear-gradient(90deg, transparent 0 7%, var(--veil) 18%, color-mix(in srgb, var(--veil) 62%, transparent) 50%, var(--veil) 82%, transparent 96%),
    linear-gradient(3deg, transparent 0 34%, rgba(169, 219, 232, 0.04) 54%, transparent 78%);
  opacity: 0.8;
}

.topbar,
main,
.site-footer {
  position: relative;
}

main,
.site-footer {
  z-index: 1;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.surprise-glass {
  position: fixed;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(169, 207, 221, 0.12)),
    radial-gradient(ellipse at 18% 20%, rgba(255, 248, 232, 0.16), transparent 42%),
    radial-gradient(ellipse at 78% 72%, rgba(133, 168, 103, 0.14), transparent 48%);
  backdrop-filter: blur(0) saturate(1) contrast(1);
  -webkit-backdrop-filter: blur(0) saturate(1) contrast(1);
  opacity: 0;
}

.is-surprise-falling .surprise-glass {
  animation: liquid-glass-fall var(--glass-duration, 1400ms) ease-out forwards;
}

[data-theme="dark"] .surprise-glass {
  background:
    linear-gradient(135deg, rgba(159, 213, 226, 0.14), rgba(18, 35, 40, 0.22)),
    radial-gradient(ellipse at 18% 20%, rgba(245, 236, 213, 0.08), transparent 42%),
    radial-gradient(ellipse at 78% 72%, rgba(143, 178, 124, 0.1), transparent 48%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 44px);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--sky) 28%, var(--surface))),
    var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  min-width: 0;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--sky-deep) 65%, transparent);
  border-radius: 50%;
  background:
    linear-gradient(145deg, var(--dress) 0 42%, transparent 43%),
    linear-gradient(180deg, var(--sky) 0 46%, var(--grass) 47% 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.34);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
}

.site-nav a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  color: var(--muted);
  font-size: 14px;
}

.site-nav a:last-child {
  border-right: 0;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: color-mix(in srgb, var(--grass) 26%, var(--surface));
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 56%, var(--sky));
}

.icon-button,
.segment,
.primary-action,
.secondary-action {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  box-shadow: none;
}

.icon-button:hover,
.icon-button:focus-visible,
.icon-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--grass) 48%, var(--line));
  background: color-mix(in srgb, var(--grass) 26%, var(--surface));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 56%, var(--sky));
  outline: none;
}

[data-theme="dark"] .site-nav a:hover,
[data-theme="dark"] .site-nav a:focus-visible,
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .icon-button:focus-visible,
[data-theme="dark"] .icon-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--grass) 58%, var(--line));
  background: color-mix(in srgb, var(--grass) 38%, var(--surface));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 62%, var(--sky));
}

.theme-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--peach);
  border-radius: 50%;
  background: var(--peach);
}

.theme-icon::after {
  content: "";
  position: absolute;
  inset: -2px 7px -2px -2px;
  background: var(--surface);
  border-radius: 50%;
}

.section {
  position: relative;
  overflow: hidden;
  padding: clamp(56px, 8vw, 96px) clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0, var(--veil) 13%, color-mix(in srgb, var(--veil) 82%, transparent) 50%, var(--veil) 87%, transparent 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%, rgba(255, 255, 255, 0.12));
  backdrop-filter: blur(2px) saturate(1.04);
}

[data-theme="dark"] .section::before {
  background:
    linear-gradient(90deg, transparent 0, var(--veil) 14%, color-mix(in srgb, var(--veil) 88%, transparent) 50%, var(--veil) 86%, transparent 100%),
    linear-gradient(180deg, rgba(159, 213, 226, 0.04), transparent 42%, rgba(143, 178, 124, 0.04));
}

.section-inner {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 34px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.3;
}

.intro-section {
  min-height: auto;
  display: grid;
  align-items: center;
  padding-block: clamp(48px, 6vw, 76px);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sky) 30%, transparent), transparent 50%),
    linear-gradient(176deg, rgba(255, 253, 244, 0.12), transparent 55%);
}

.intro-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(18px, 3vw, 28px);
}

.profile-heading {
  margin-bottom: 20px;
  padding-block: 16px;
}

.profile-heading h1 {
  margin-bottom: 0;
}

.portrait-frame,
.profile-copy,
.section-heading,
.surprise-tool {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.46), transparent 42%),
    color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--lift-shadow);
  backdrop-filter: blur(10px) saturate(1.06);
}

.portrait-frame {
  display: grid;
  align-content: center;
  margin: 0;
  padding: clamp(12px, 1.6vw, 16px);
}

#profileImage {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: none;
  cursor: pointer;
  object-fit: cover;
  transition: border-color 180ms ease, filter 180ms ease, transform 180ms ease;
}

#profileImage:hover,
#profileImage:focus-visible {
  border-color: color-mix(in srgb, var(--sky-deep) 64%, var(--line));
  filter: saturate(1.08);
  outline: none;
  transform: translateY(-1px);
}

.portrait-frame figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.profile-copy {
  position: relative;
  display: grid;
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.profile-selector {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: end;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.profile-selector .segment {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 112px;
  min-height: 48px;
  height: 48px;
  flex: 0 0 auto;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  box-shadow: none;
  color: var(--muted);
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.profile-selector .segment::before {
  content: none;
}

.profile-selector .segment:first-child {
  border-top-left-radius: calc(var(--radius) - 1px);
}

.profile-selector .segment:last-child {
  border-bottom-right-radius: 7px;
}

.profile-selector .segment:hover,
.profile-selector .segment:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--sky) 22%, var(--surface));
  transform: none;
  outline: none;
  z-index: 1;
}

.profile-selector .segment.is-active,
.profile-selector .segment[aria-pressed="true"] {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--grass) 48%, var(--line));
  background: color-mix(in srgb, var(--grass) 26%, var(--surface));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 56%, var(--sky));
  font-weight: 700;
  transform: none;
  z-index: 2;
}

.profile-selector .segment.is-active::before,
.profile-selector .segment[aria-pressed="true"]::before {
  content: none;
}

[data-theme="dark"] .profile-selector .segment.is-active,
[data-theme="dark"] .profile-selector .segment[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--grass) 58%, var(--line));
  background: color-mix(in srgb, var(--grass) 38%, var(--surface));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 62%, var(--sky));
}

.profile-pages {
  display: grid;
  align-items: center;
  margin: 0;
  padding: clamp(16px, 2.4vw, 22px);
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 44%),
    transparent;
  box-shadow: inset 0 8px 12px -12px color-mix(in srgb, var(--ink) 18%, transparent);
  min-height: 170px;
}

.profile-page {
  width: 100%;
}

.profile-page[hidden] {
  display: none;
}

.profile-details {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  min-height: 170px;
}

.detail-row {
  display: grid;
  min-height: 0;
  align-content: center;
  gap: 3px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 42%),
    var(--surface);
}

.detail-row dt {
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.detail-row dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.intro-card {
  display: grid;
  align-items: center;
}

.favorite-question {
  display: grid;
  gap: 12px;
}

.favorite-headline {
  margin-bottom: 0;
  color: var(--ink);
}

.favorite-headline span {
  color: var(--accent-text);
}

.favorite-answer {
  display: grid;
  min-height: 76px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 42%),
    var(--surface);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.favorite-answer[data-empty="true"] {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.favorite-action {
  justify-self: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding: 18px 20px;
}

.section-heading h1,
.section-heading h2 {
  margin-bottom: 0;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18), transparent 58%),
    var(--surface-muted);
}

.segment {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.segment.is-active,
.segment:hover,
.segment:focus-visible {
  color: var(--ink);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--dress) 80%, var(--sky)), var(--surface));
  outline: none;
}

.data-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.data-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  min-height: 320px;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 48%),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(1.08);
}

.songs-panel {
  grid-column: 1 / -1;
}

.data-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.data-panel-header h3 {
  margin-bottom: 4px;
}

.data-panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.contribution-grid {
  min-height: 190px;
  max-width: 100%;
  overflow: visible;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 48%),
    color-mix(in srgb, var(--surface) 96%, #fff);
}

.contribution-chart {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  max-width: 100%;
}

.contribution-days {
  display: grid;
  grid-template-rows: repeat(7, 16px);
  gap: 5px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
  text-align: right;
}

.contribution-days span {
  height: 16px;
}

.contribution-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.contribution-months {
  display: grid;
  grid-template-columns: repeat(var(--contribution-weeks, 5), 16px);
  gap: 5px;
  width: max-content;
  min-width: 100%;
  height: 18px;
  margin-bottom: 6px;
}

.contribution-month {
  grid-row: 1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.contribution-cells {
  display: grid;
  grid-template-rows: repeat(7, 16px);
  grid-auto-flow: column;
  grid-auto-columns: 16px;
  gap: 5px;
  width: max-content;
  min-width: 100%;
}

.contribution-cell {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  min-height: 16px;
  border: 1px solid color-mix(in srgb, var(--heat-4) 28%, transparent);
  border-radius: 4px;
  background: var(--heat-1);
  outline: none;
}

.contribution-cell:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sky-deep) 44%, transparent);
}

.contribution-chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift-shadow);
  font-size: 12px;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% + 4px));
  transition: opacity 160ms ease, transform 160ms ease;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.contribution-chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%);
}

.contribution-cell.level-0,
.contribution-cell.is-empty {
  border-color: color-mix(in srgb, var(--heat-3) 36%, transparent);
  background: color-mix(in srgb, var(--surface) 96%, #fff);
  opacity: 1;
}

.contribution-cell.level-1,
.legend-swatch.level-1 {
  background: var(--heat-1);
}

.contribution-cell.level-2,
.legend-swatch.level-2 {
  background: var(--heat-2);
}

.contribution-cell.level-3,
.legend-swatch.level-3 {
  background: var(--heat-3);
}

.contribution-cell.level-4,
.legend-swatch.level-4 {
  background: var(--heat-4);
}

[data-theme="dark"] .contribution-cell,
[data-theme="dark"] .legend-swatch {
  border-color: rgba(220, 238, 207, 0.24);
}

.intensity-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--heat-4) 32%, transparent);
  border-radius: 4px;
}

.vertical-bar-chart {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 220px;
  max-width: 100%;
  overflow: visible;
  padding: 12px 12px 34px 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 48%),
    color-mix(in srgb, var(--surface) 96%, #fff);
}

.vertical-bar-scroll {
  display: grid;
  grid-template-columns: repeat(var(--step-count, 30), 18px);
  align-items: start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 206px;
  max-width: 100%;
  contain: inline-size;
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-y-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-y-tick {
  position: absolute;
  right: 12px;
  left: 42px;
  bottom: var(--tick-bottom);
  border-top: 1px solid color-mix(in srgb, var(--line) 46%, transparent);
}

.chart-y-tick span {
  position: absolute;
  top: -8px;
  left: -34px;
  width: 28px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  text-align: right;
}

.vertical-bar-slot {
  position: relative;
  display: block;
  min-width: 0;
  height: 206px;
  outline: none;
}

.vertical-bar-slot.is-empty {
  height: 46px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 94%, var(--sky));
  opacity: 0.74;
}

.vertical-bar-track {
  display: flex;
  height: 178px;
  align-items: end;
  overflow: hidden;
  border: 1px solid rgba(88, 122, 78, 0.28);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 94%, var(--sky));
}

.vertical-bar-fill {
  width: 100%;
  height: var(--bar-height, 0%);
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 58%),
    var(--chart-bar-fill);
}

.vertical-bar-slot:hover .vertical-bar-track,
.vertical-bar-slot:focus-visible .vertical-bar-track {
  border-color: rgba(88, 122, 78, 0.58);
}

.chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift-shadow);
  font-size: 12px;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% + 4px));
  transition: opacity 160ms ease, transform 160ms ease;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.chart-x-tick {
  position: absolute;
  left: 50%;
  bottom: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.chart-x-tick::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 1px;
  height: 5px;
  background: color-mix(in srgb, var(--line) 82%, transparent);
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%);
}

.horizontal-bar-chart {
  --song-label-column: minmax(140px, 220px);
  --song-value-column: minmax(82px, 88px);
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 220px;
  overflow: visible;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 48%),
    color-mix(in srgb, var(--surface) 96%, #fff);
}

.horizontal-bar-chart.is-empty {
  place-items: center;
}

.song-bar-row {
  display: grid;
  grid-template-columns: var(--song-label-column) minmax(0, 1fr) var(--song-value-column);
  align-items: center;
  gap: 12px;
  border-radius: calc(var(--radius) - 2px);
  outline: none;
}

.song-bar-row:hover .song-bar-track,
.song-bar-row:focus-visible .song-bar-track {
  border-color: color-mix(in srgb, var(--sky-deep) 48%, var(--line));
}

.song-bar-row:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sky-deep) 32%, transparent);
}

.song-text,
.song-count {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.song-count {
  text-align: center;
}

.song-text {
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
}

.song-title {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.28;
}

.song-author {
  color: color-mix(in srgb, var(--muted) 76%, var(--surface));
  font-size: 12px;
  line-height: 1.25;
}

.song-bar-track {
  height: 18px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 96%, #fff);
}

.song-bar-fill {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(106deg, rgba(255, 255, 255, 0.22), transparent 58%),
    color-mix(in srgb, var(--sky-deep) 58%, var(--grass));
}

.song-axis {
  display: grid;
  grid-template-columns: var(--song-label-column) minmax(0, 1fr) var(--song-value-column);
  gap: 12px;
  min-height: 20px;
}

.song-axis-scale {
  position: relative;
  min-height: 20px;
  border-top: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
}

.song-axis-tick {
  position: absolute;
  top: -1px;
  left: var(--tick-left);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.song-axis-tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 5px;
  margin: 0 auto 4px;
  background: color-mix(in srgb, var(--line) 82%, transparent);
}

.song-axis-label {
  justify-self: stretch;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.empty-state {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.egg-section {
  background:
    linear-gradient(116deg, color-mix(in srgb, var(--violet) 12%, transparent), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-muted) 34%, transparent), color-mix(in srgb, var(--grass) 14%, transparent));
}

.egg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}

.surprise-tool {
  min-width: 0;
  padding: clamp(18px, 3vw, 24px);
}

.blocks-generator {
  display: grid;
  align-content: start;
  gap: 18px;
}

.surprise-tool-header h3 {
  margin-bottom: 0;
}

.blocks-generator-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: stretch;
  gap: 22px;
}

.surprise-preview {
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 0;
}

#surpriseImagePreview {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: calc(var(--radius) - 2px);
  object-fit: cover;
}

.surprise-swatches {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.surprise-swatch {
  display: block;
  min-height: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: calc(var(--radius) - 3px);
  background: var(--swatch-color);
}

.egg-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-content: center;
  gap: 16px;
}

.surprise-tip {
  grid-column: 1 / -1;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.primary-action {
  display: inline-flex;
  grid-column: 1 / -1;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(135deg, var(--button-start), var(--button-end));
  color: var(--button-text);
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(52, 86, 80, 0.18);
}

.primary-action:hover,
.primary-action:focus-visible {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(135deg, var(--button-hover-start), var(--button-hover-end));
  color: var(--button-text);
  box-shadow: 0 14px 28px rgba(92, 75, 84, 0.22);
  outline: none;
}

.upload-action {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.upload-action:hover,
.upload-action:focus-within {
  border-color: color-mix(in srgb, var(--grass) 48%, var(--line));
  background: color-mix(in srgb, var(--grass) 22%, var(--surface));
  outline: none;
}

.upload-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.upload-icon::before,
.upload-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.upload-icon::before {
  width: 10px;
  height: 2px;
}

.upload-icon::after {
  width: 2px;
  height: 10px;
}

.song-recommender {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  align-items: stretch;
  gap: 16px;
}

.song-recommender h3 {
  margin-bottom: 0;
}

.song-recommender .secondary-action {
  grid-column: auto;
  grid-row: auto;
}

.song-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.song-actions .secondary-action {
  width: 100%;
}

.song-recommendation {
  display: grid;
  grid-column: 1;
  gap: 2px;
  min-width: 0;
}

.recommend-title {
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.recommend-author {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.secondary-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: color-mix(in srgb, var(--sky-deep) 48%, var(--line));
  background: color-mix(in srgb, var(--sky) 24%, var(--surface));
  outline: none;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.recommend-icon {
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.recommend-icon::before,
.recommend-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
}

.recommend-icon::before {
  width: 10px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-56%, -50%);
}

.recommend-icon::after {
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  background: transparent;
  transform: translate(-18%, -50%) rotate(45deg);
  transform-origin: center;
}

.play-icon {
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.play-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transform: translate(-50%, -50%);
}

.action-icon {
  position: relative;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.action-icon::before,
.action-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.action-icon::before {
  width: 28px;
  height: 2px;
}

.action-icon::after {
  width: 2px;
  height: 28px;
}

.range-field {
  display: grid;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.range-field input {
  width: 100%;
  accent-color: var(--grass-deep);
}

.particle {
  position: fixed;
  z-index: 30;
  width: var(--particle-size, 12px);
  height: var(--particle-size, 12px);
  pointer-events: none;
  background: var(--particle-color, var(--sky-deep));
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(35, 59, 61, 0.12);
  animation: block-fall var(--particle-duration, 1200ms) cubic-bezier(0.18, 0.7, 0.34, 1) forwards;
}

.is-awake #profileImage {
  outline: 3px solid color-mix(in srgb, var(--peach) 70%, transparent);
  outline-offset: 5px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px clamp(18px, 4vw, 44px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  font-size: 14px;
}

.footer-credit {
  min-width: 0;
}

.footer-top-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
  color: var(--muted);
  font-size: 14px;
}

.footer-top-link:hover,
.footer-top-link:focus-visible {
  border-color: color-mix(in srgb, var(--grass) 48%, var(--line));
  background: color-mix(in srgb, var(--grass) 26%, var(--surface));
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 56%, var(--sky));
}

[data-theme="dark"] .footer-top-link:hover,
[data-theme="dark"] .footer-top-link:focus-visible {
  border-color: color-mix(in srgb, var(--grass) 58%, var(--line));
  background: color-mix(in srgb, var(--grass) 38%, var(--surface));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--grass) 62%, var(--sky));
}

@keyframes block-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.88);
  }

  10% {
    opacity: 1;
  }

  42% {
    opacity: 1;
    transform: translate3d(var(--mid-x), var(--mid-y), 0) rotate(var(--mid-spin)) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--end-x), var(--end-y), 0) rotate(var(--spin)) scale(0.96);
  }
}

@keyframes liquid-glass-fall {
  0% {
    opacity: 0;
    backdrop-filter: blur(0) saturate(1) contrast(1);
    -webkit-backdrop-filter: blur(0) saturate(1) contrast(1);
  }

  12% {
    opacity: 1;
    backdrop-filter: blur(12px) saturate(1.46) contrast(1.05);
    -webkit-backdrop-filter: blur(12px) saturate(1.46) contrast(1.05);
  }

  58% {
    opacity: 0.72;
    backdrop-filter: blur(6px) saturate(1.22) contrast(1.03);
    -webkit-backdrop-filter: blur(6px) saturate(1.22) contrast(1.03);
  }

  100% {
    opacity: 0;
    backdrop-filter: blur(0) saturate(1) contrast(1);
    -webkit-backdrop-filter: blur(0) saturate(1) contrast(1);
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    grid-column: 1 / -1;
    justify-content: space-between;
    overflow-x: auto;
  }

  .intro-layout,
  .egg-layout {
    grid-template-columns: 1fr;
  }

  .blocks-generator-grid {
    grid-template-columns: 1fr;
  }

  .portrait-frame {
    max-width: 360px;
    margin-top: 0;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    width: 100%;
  }

  .segment {
    flex: 1;
  }

  .profile-copy {
    padding: 0;
  }

  .profile-selector {
    width: max-content;
    max-width: 100%;
    gap: 0;
  }

  .profile-selector .segment {
    width: auto;
    min-width: 112px;
    min-height: 48px;
    height: 48px;
    flex: 0 0 auto;
  }

  .data-panel-grid {
    grid-template-columns: 1fr;
  }

  .songs-panel {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .topbar {
    min-height: 64px;
    gap: 12px;
  }

  .brand {
    max-width: 100%;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-nav a {
    padding-inline: 10px;
    white-space: nowrap;
  }

  .profile-copy {
    padding: 0;
  }

  .profile-selector {
    position: relative;
    display: inline-flex;
    align-items: end;
    justify-self: start;
    width: max-content;
    max-width: 100%;
    gap: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .profile-selector .segment {
    width: auto;
    min-width: 82px;
    min-height: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    border-radius: 0;
    background: color-mix(in srgb, var(--surface-muted) 76%, var(--surface));
    box-shadow: none;
    writing-mode: horizontal-tb;
  }

  .profile-selector .segment:first-child {
    border-top-left-radius: calc(var(--radius) - 1px);
  }

  .profile-selector .segment:last-child {
    border-bottom-right-radius: 7px;
  }

  .profile-pages {
    margin: 0;
    padding: 18px;
  }

  .detail-row {
    gap: 4px;
    padding: 8px 12px;
  }

  .profile-selector .segment.is-active,
  .profile-selector .segment:hover,
  .profile-selector .segment:focus-visible {
    transform: none;
  }

  h1,
  h2 {
    font-size: 28px;
  }

  .data-panel {
    min-height: 280px;
  }

  .egg-controls {
    grid-template-columns: 1fr;
  }

  .song-recommender {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .song-recommender .secondary-action {
    grid-column: auto;
    grid-row: auto;
  }

  .secondary-action {
    width: 100%;
  }

  .contribution-grid {
    min-height: 168px;
    padding: 8px;
  }

  .contribution-chart {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
  }

  .contribution-days {
    grid-template-rows: repeat(7, 14px);
    gap: 4px;
    margin-top: 22px;
    font-size: 9px;
    line-height: 14px;
  }

  .contribution-days span {
    height: 14px;
  }

  .contribution-months {
    grid-template-columns: repeat(var(--contribution-weeks, 5), 14px);
    gap: 4px;
    height: 16px;
    margin-bottom: 6px;
  }

  .contribution-cells {
    grid-template-rows: repeat(7, 14px);
    grid-auto-columns: 14px;
    gap: 4px;
  }

  .contribution-cell {
    width: 14px;
    height: 14px;
    min-height: 14px;
  }

  .data-panel-header,
  .song-bar-row,
  .song-axis {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .data-panel-header {
    display: grid;
  }

  .vertical-bar-chart {
    padding: 12px 8px 34px 36px;
  }

  .vertical-bar-scroll {
    grid-template-columns: repeat(var(--step-count, 30), 16px);
    gap: 4px;
  }

  .chart-y-tick {
    right: 8px;
    left: 36px;
  }

  .chart-y-tick span {
    left: -32px;
  }

  .song-bar-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .song-axis {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .song-axis-label {
    position: static;
    display: block;
    margin-top: 8px;
  }

  .song-axis > span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
