:root {
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-hover: #19191f;
  --surface-subtle: rgba(255, 255, 255, 0.035);
  --surface-strong: #1b1b21;
  --border: rgba(255, 255, 255, 0.075);
  --border-hover: rgba(255, 255, 255, 0.16);
  --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.065);
  --text: #f3f3f6;
  --text-secondary: #a0a0ab;
  --text-muted: #6c6c77;
  --amber: #e6a856;
  --sky: #7cb6f6;
  --sage: #73c59b;
  --violet: #b39ddb;
  --rose: #e0919c;
  --radius-xl: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 65% 42% at 50% -8%, rgba(255, 255, 255, 0.055), transparent 72%);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page-shell {
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: 24px;
  border-radius: 18px;
  background: rgba(20, 20, 24, 0.72);
  border: 1px solid var(--border);
  box-shadow: var(--inner-highlight);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 14px;
  z-index: 40;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #272730, #191920);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 6px 13px;
  border-radius: 999px;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.topnav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* Bento Grid Base */
.bento-main {
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}

/* Tactile Apple-Dark Bento Tile */
.tile {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--inner-highlight), 0 10px 30px rgba(0, 0, 0, 0.28);
  padding: 26px;
  transition: border-color 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.055),
    transparent 65%
  );
}

.tile:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.tile:hover::before {
  opacity: 1;
}

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.tile-label {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.subtle-pill {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* Hero Bento Layout */
.tile-profile {
  grid-column: span 7;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.045), transparent 55%),
    var(--surface);
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar-badge {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(145deg, #2b2b34, #17171d);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.profile-heading h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2.8vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.profile-tagline {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.profile-intro {
  margin: 0;
  color: #c5c5cf;
  font-size: 0.98rem;
  line-height: 1.8;
  max-width: 48ch;
}

.profile-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.topic-pill:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.07);
}

/* Focus Tile */
.tile-focus {
  grid-column: span 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.focus-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.focus-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 0.91rem;
  color: #d1d1da;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-amber { background: var(--amber); }
.dot-sky { background: var(--sky); }
.dot-sage { background: var(--sage); }
.dot-violet { background: var(--violet); }
.dot-rose { background: var(--rose); }

/* Stat Tile */
.tile-stat {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}

.stat-body {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 10px 0 6px;
}

.stat-num {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-caption {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Contact Tile */
.tile-contact {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}

.contact-domain {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
  font-size: 0.79rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.16s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.chip-btn-muted {
  color: var(--text-secondary);
  background: transparent;
}

/* Section Headers */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 0 4px;
}

.section-bar h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-sub {
  margin: 4px 0 0;
  font-size: 0.87rem;
  color: var(--text-muted);
}

/* Filter Pills */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.16s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.filter-btn.is-active {
  background: var(--text);
  color: #0b0b0e;
  border-color: var(--text);
  font-weight: 600;
}

/* Notes Bento Cards */
.note-tile {
  grid-column: span 6;
  appearance: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.note-tile.is-featured {
  grid-column: span 7;
  background:
    radial-gradient(100% 100% at 100% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--surface);
}

.note-tile.is-companion {
  grid-column: span 5;
}

.note-tile:hover {
  transform: translateY(-2px);
}

.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.note-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: #d6d6df;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.note-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.note-title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.42;
  color: var(--text);
}

.note-tile.is-featured .note-title {
  font-size: 1.32rem;
}

.note-summary {
  margin: 0;
  font-size: 0.91rem;
  line-height: 1.72;
  color: var(--text-secondary);
}

.note-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-tag {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  padding: 2px 9px;
  border-radius: 6px;
}

.note-arrow {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: transform 0.18s ease, color 0.18s ease;
}

.note-tile:hover .note-arrow {
  color: var(--text);
  transform: translateX(3px);
}

.empty-tile {
  grid-column: span 12;
  text-align: center;
  padding: 42px 24px;
  color: var(--text-muted);
}

/* Tracks Bento Mosaic */
.track-tile {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  appearance: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
}

.track-tile.is-wide {
  grid-column: span 6;
}

.track-tile:hover {
  transform: translateY(-2px);
}

.track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.track-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 600;
  color: var(--text);
}

.track-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.track-desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.68;
  color: var(--text-secondary);
}

/* About Tile */
.tile-about {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 28px;
  align-items: center;
  padding: 32px;
}

.about-copy h2 {
  margin: 8px 0 12px;
  font-size: 1.38rem;
  letter-spacing: -0.015em;
}

.about-copy p {
  margin: 0 0 12px;
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.78;
}

.about-copy code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.about-note {
  margin-bottom: 0 !important;
  font-size: 0.86rem !important;
  color: var(--text-muted) !important;
}

.about-specs {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 0.86rem;
}

.spec-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.spec-k {
  color: var(--text-muted);
  flex-shrink: 0;
}

.spec-v {
  color: #dcdce4;
  text-align: right;
}

.spec-link {
  color: var(--text);
  text-decoration: none;
}

.spec-link:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  margin-top: 44px;
  padding: 22px 6px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.beian-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.16s ease;
}

.beian-link:hover {
  color: var(--text);
}

.footer-sep {
  opacity: 0.4;
}

/* Reading Sheet Modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-sheet {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  background: #15151a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  box-shadow: var(--inner-highlight), 0 30px 80px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-close {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-hover);
}

.modal-body {
  padding: 28px 30px 34px;
  overflow-y: auto;
}

.modal-title {
  margin: 0 0 14px;
  font-size: 1.48rem;
  line-height: 1.38;
  letter-spacing: -0.015em;
}

.prose {
  margin-top: 22px;
  color: #cfcfd8;
  font-size: 0.97rem;
  line-height: 1.88;
}

.prose h3 {
  margin: 24px 0 10px;
  font-size: 1.08rem;
  color: var(--text);
}

.prose p {
  margin: 0 0 14px;
}

.prose ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 6px;
}

.prose pre {
  margin: 14px 0 18px;
  padding: 15px 17px;
  background: #0d0d11;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  color: #e4e4ec;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  padding: 2px 6px;
  border-radius: 6px;
}

.prose pre code {
  background: none;
  padding: 0;
}

/* Responsive */
@media (max-width: 920px) {
  .tile-profile {
    grid-column: span 12;
    grid-row: span 1;
  }

  .tile-focus {
    grid-column: span 12;
  }

  .tile-stat {
    grid-column: span 5;
  }

  .tile-contact {
    grid-column: span 7;
  }

  .note-tile,
  .note-tile.is-featured,
  .note-tile.is-companion {
    grid-column: span 12;
  }

  .track-tile,
  .track-tile.is-wide {
    grid-column: span 6;
  }

  .tile-about {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: calc(100% - 24px);
    padding-top: 12px;
  }

  .tile,
  .tile-profile,
  .tile-about {
    padding: 22px;
    border-radius: 20px;
  }

  .tile-stat,
  .tile-contact,
  .track-tile,
  .track-tile.is-wide {
    grid-column: span 12;
  }

  .modal-body {
    padding: 22px;
  }
}
