:root {
  color-scheme: light;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #f5f6fb;
  --surface: #fff;
  --sunken: #eef0f8;
  --text: #14172b;
  --muted: #565c78;
  --subtle: #6a7090;
  --border: #e2e5f0;
  --accent: #0a7566;
  --accent-soft: #e3f6f2;
  --violet: #6d4ae0;
  --ring: #6d4ae033;
  --glass: #f5f6fbe8;
  --glow: #8b6cff0b;
  --shadow: 0 2px 4px #14172b03, 0 16px 44px -24px #2a2f5a24;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d17;
  --surface: #131626;
  --sunken: #0f1220;
  --text: #eef0fa;
  --muted: #a3a9c6;
  --subtle: #8189a8;
  --border: #252a44;
  --accent: #5eead4;
  --accent-soft: #11302f;
  --violet: #9b7bff;
  --ring: #9b7bff59;
  --glass: #0b0d17e8;
  --glow: #9b7bff0a;
  --shadow: 0 2px 4px #0002, 0 16px 44px -24px #0007;
}

/* JavaScript 关闭或未能加载时，页面仍可跟随系统配色。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0b0d17;
    --surface: #131626;
    --sunken: #0f1220;
    --text: #eef0fa;
    --muted: #a3a9c6;
    --subtle: #8189a8;
    --border: #252a44;
    --accent: #5eead4;
    --accent-soft: #11302f;
    --violet: #9b7bff;
    --ring: #9b7bff59;
    --glass: #0b0d17e8;
    --glow: #9b7bff0a;
    --shadow: 0 2px 4px #0002, 0 16px 44px -24px #0007;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 104px; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 620px 420px at 82% 20%, var(--glow), transparent), var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--violet); outline-offset: 4px; box-shadow: 0 0 0 5px var(--ring); }
::selection { background: var(--accent-soft); color: var(--accent); }
h1, h2, h3, p { margin: 0; }
svg { display: block; flex-shrink: 0; }
.skip-link { position: fixed; z-index: 10; top: 12px; left: 16px; padding: 10px 16px; border-radius: 10px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; z-index: 5; top: 0; border-bottom: 1px solid var(--border); background: var(--bg); }
@supports (backdrop-filter: blur(18px)) {
  .site-header { background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); }
}
.header-inner { max-width: 1104px; height: 88px; margin: auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; border-radius: 14px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-name { font-size: 17px; font-weight: 720; letter-spacing: .04em; line-height: 1.5; }
.brand-domain { color: var(--subtle); font: 12px/1.6 var(--font-mono); letter-spacing: .02em; }
.header-tools { display: flex; align-items: center; gap: 32px; }
.site-nav { display: flex; gap: 8px; }
.site-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); transition: color 160ms var(--ease), background 160ms var(--ease); }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.theme-switcher { display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--sunken); border: 1px solid var(--border); border-radius: 999px; }
.theme-switcher button { width: 40px; height: 36px; padding: 10px; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: color 160ms var(--ease), background 160ms var(--ease); }
.theme-switcher button[aria-checked="true"] { background: var(--surface); color: var(--violet); box-shadow: 0 1px 3px #14172b12; }
.theme-switcher button:hover { color: var(--violet); }
.theme-switcher button:active { transform: translateY(1px); }
.theme-switcher svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.page { width: 100%; max-width: 1104px; margin: 0 auto; padding: 48px 32px 0; flex: 1; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .12em; }
.little-line { width: 20px; height: 2px; background: var(--accent); }
.about { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px 16px; scroll-margin-top: 16px; }
.about-icon { grid-row: 1 / 3; width: 28px; height: 28px; color: var(--subtle); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.about h2 { font-size: 15px; font-weight: 700; }
.about p { grid-column: 2; font-size: 13px; line-height: 1.85; color: var(--muted); }

.diary-section { scroll-margin-top: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 720; }
.heading-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.diary-entry { display: grid; grid-template-columns: 136px minmax(0, 1fr); padding: 36px 40px 32px 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.entry-date { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.entry-date time { display: flex; flex-direction: column; align-items: center; font-variant-numeric: tabular-nums; }
.date-year { color: var(--subtle); font: 12px/1.6 var(--font-mono); letter-spacing: .12em; }
.date-day { font: 500 26px/1.6 var(--font-mono); letter-spacing: -.06em; }
.date-weekday { margin-top: 2px; color: var(--subtle); font-size: 12px; }
.date-line { width: 1px; flex: 1; min-height: 24px; max-height: 72px; margin-top: 24px; background: var(--border); }
.entry-body { min-width: 0; }
.entry-category { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.entry-body h3 { margin-top: 14px; font-size: 24px; line-height: 1.4; font-weight: 720; letter-spacing: -.02em; }
.entry-content { margin-top: 20px; color: var(--muted); line-height: 1.9; }
.entry-content p + p { margin-top: 8px; }
.entry-afterword { display: flex; align-items: center; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--accent); font-size: 12px; }
.entry-afterword svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.closing-note { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 32px 0 40px; color: var(--subtle); font-size: 12px; letter-spacing: .12em; }
.closing-note span { width: 24px; height: 1px; background: var(--border); }

.site-footer { padding: 0 32px; }
.footer-inner { max-width: 1040px; margin: auto; padding: 24px 0 calc(28px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--subtle); }
.copyright { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.footer-divider { color: var(--border); }
.footer-domain { font-family: var(--font-mono); }
.filing-info { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.filing-divider { width: 1px; height: 12px; background: var(--border); }
.filing-info a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 24px; text-underline-offset: 3px; }
.filing-info a:hover { color: var(--accent); text-decoration: underline; }
.filing-info img { display: block; width: 20px; height: auto; flex-shrink: 0; }

@media (min-width: 1600px) {
  .page { padding-top: 64px; }
}
@media (max-width: 1023px) {
  .header-inner { padding: 0 24px; height: 80px; }
  .page { padding: 40px 24px 0; }
  .diary-entry { grid-template-columns: 112px minmax(0, 1fr); padding-right: 32px; }
  .site-footer { padding: 0 24px; }
}
@media (max-width: 639px) {
  html { scroll-padding-top: 144px; }
  .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 12px 16px; gap: 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 15px; }
  .brand-domain { font-size: 12px; }
  .header-tools { display: contents; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; }
  .site-nav a { flex: 1; }
  .theme-switcher { grid-column: 2; grid-row: 1; }
  .theme-switcher { padding: 3px; gap: 0; }
  .theme-switcher button { width: 40px; height: 40px; }
  .page { padding: 28px 16px 0; }
  .eyebrow { margin-bottom: 20px; }
  .about { display: block; border-left: 1px solid var(--border); padding-left: 16px; }
  .about-icon { display: none; }
  .about h2 { margin-bottom: 8px; font-size: 13px; }
  .section-heading { margin-bottom: 16px; }
  .diary-entry { grid-template-columns: minmax(0, 1fr); padding: 24px 20px; }
  .entry-date { align-items: flex-start; padding: 0 0 16px; }
  .entry-date time { flex-direction: row; gap: 8px; align-items: baseline; color: var(--subtle); }
  .date-year, .date-day { font: 12px/1.6 var(--font-mono); letter-spacing: 0; }
  .date-year::after { content: "."; margin-left: 8px; }
  .date-weekday { margin: 0 0 0 4px; }
  .date-line { display: none; }
  .entry-body h3 { margin-top: 12px; font-size: 22px; }
  .entry-content { margin-top: 16px; }
  .entry-content p + p { margin-top: 12px; }
  .entry-afterword { margin-top: 24px; padding-top: 16px; }
  .closing-note { margin: 28px 0 32px; }
  .site-footer { padding: 0 16px; }
  .footer-inner { padding-top: 20px; }
  .filing-info { flex-direction: column; gap: 6px; }
  .filing-divider { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .theme-switcher button:active { transform: none; }
}
