  /* ─────────────────────────────────────────────
     Themes
     Light: a summer afternoon on the hill (sky, paper, wood)
     Dark:  a hearth at night (embers, soot, flame)
     ───────────────────────────────────────────── */
  :root {
    color-scheme: light;
    --font-body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
    --font-display: 'Kaisei Decol', Georgia, serif;

    --bg: #fbf6ea;
    --sky-top: #a9d4ee;
    --sky-mid: #d8ecf6;
    --cloud: rgba(255, 255, 255, 0.6);
    --hill-far: #cfe3c4;
    --hill-near: #b9d6a9;
    --nav-bg: rgba(251, 246, 234, 0.82);
    --surface: #fffdf7;
    --surface-hover: #fffaf0;
    --border: #e7dcc6;
    --border-strong: #cdb894;
    --chip-bg: rgba(120, 90, 50, 0.05);
    --shadow: 0 1px 0 rgba(120, 90, 50, 0.06), 0 10px 24px -16px rgba(80, 60, 30, 0.35);
    --shadow-hover: 0 1px 0 rgba(120, 90, 50, 0.08), 0 16px 30px -16px rgba(47, 110, 158, 0.35);
    --text: #2c3245;
    --text-muted: #646a7a;
    --accent: #2e6f9e;
    --green: #3d8a5a;
    --blue: #3a6fb8;
    --amber: #a8701f;
    --purple: #7a5aa6;
    --white: #4b4f60;
    --orange: #c0602f;
    --teal: #2a8580;
    --section-accent: #2e6f9e;
    --section-green: #c8553d;
    --section-blue: #d29a2e;
    --section-purple: #5f9e6e;
    --section-amber: #8a6bb8;
    --ember: transparent;
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #120d0c;
    --sky-top: #17121f;
    --sky-mid: #120d0c;
    --cloud: transparent;
    --hill-far: transparent;
    --hill-near: transparent;
    --nav-bg: rgba(18, 13, 12, 0.84);
    --surface: #1c1412;
    --surface-hover: #241915;
    --border: #3a2a23;
    --border-strong: #6a4130;
    --chip-bg: rgba(255, 170, 90, 0.04);
    --shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 0 0 1px rgba(255, 138, 61, 0.15), 0 14px 36px -14px rgba(255, 110, 40, 0.35);
    --text: #f5e8d5;
    --text-muted: #b49e8a;
    --accent: #ff8a3d;
    --green: #a8d67e;
    --blue: #7fb6ff;
    --amber: #ffc93c;
    --purple: #cda6ff;
    --white: #f5e8d5;
    --orange: #ff9f5a;
    --teal: #6fd0c4;
    --section-accent: #ff8a3d;
    --section-green: #ffc93c;
    --section-blue: #e0472b;
    --section-purple: #7fb6ff;
    --section-amber: #f5e8d5;
    --ember: #ffb45c;
  }

  /* No-JS fallback: follow the system setting */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
      color-scheme: dark;
      --bg: #120d0c; --sky-top: #17121f; --sky-mid: #120d0c; --cloud: transparent;
      --hill-far: transparent; --hill-near: transparent; --nav-bg: rgba(18, 13, 12, 0.84);
      --surface: #1c1412; --surface-hover: #241915; --border: #3a2a23; --border-strong: #6a4130;
      --chip-bg: rgba(255, 170, 90, 0.04); --shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.8);
      --shadow-hover: 0 0 0 1px rgba(255, 138, 61, 0.15), 0 14px 36px -14px rgba(255, 110, 40, 0.35);
      --text: #f5e8d5; --text-muted: #b49e8a; --accent: #ff8a3d; --green: #a8d67e; --blue: #7fb6ff;
      --amber: #ffc93c; --purple: #cda6ff; --white: #f5e8d5; --orange: #ff9f5a; --teal: #6fd0c4;
      --section-accent: #ff8a3d; --section-green: #ffc93c; --section-blue: #e0472b;
      --section-purple: #7fb6ff; --section-amber: #f5e8d5; --ember: #ffb45c;
    }
  }

  :root {
    --accent-glow: color-mix(in srgb, var(--accent) 16%, transparent);
    --accent-soft: color-mix(in srgb, var(--accent) 8%, transparent);
    --green-soft: color-mix(in srgb, var(--green) 10%, transparent);
    --blue-soft: color-mix(in srgb, var(--blue) 10%, transparent);
    --amber-soft: color-mix(in srgb, var(--amber) 11%, transparent);
    --purple-soft: color-mix(in srgb, var(--purple) 10%, transparent);
    --white-soft: color-mix(in srgb, var(--white) 8%, transparent);
    --orange-soft: color-mix(in srgb, var(--orange) 10%, transparent);
    --teal-soft: color-mix(in srgb, var(--teal) 10%, transparent);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: var(--font-body);
    background: var(--bg);
    transition: background-color 0.4s, color 0.4s;
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }

  html { scroll-behavior: smooth; }

  .layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 110px 28px 0;
    display: grid;
    grid-template-columns: 190px minmax(0, 780px);
    gap: 56px;
    justify-content: center;
  }

  .page { min-width: 0; padding-bottom: 100px; }

  nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
  }

  nav .nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  nav .logo {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    font-style: italic;
  }

  nav .nav-links {
    display: flex;
    gap: 28px;
  }

  nav a {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }

  nav a:hover { color: var(--accent); }
  nav a.active { color: var(--text); }

  .hero { padding: 20px 0 64px; }
  .hero .links { margin-top: 0; }

  

  .research-title {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: -1px;
    line-height: 1.15;
    margin-bottom: 28px;
  }


  .overline {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
  }

  h1 {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -1px;
    line-height: 1.12;
    margin-bottom: 24px;
  }

  .subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 580px;
    line-height: 1.75;
    margin-bottom: 32px;
  }

  .hero .subtitle { margin-bottom: 10px; }

  .quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--accent);
    margin-bottom: 32px;
  }

  .quote span {
    font-family: var(--font-body);
    font-style: normal;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 6px;
  }

  .bio {
    font-size: 0.92rem;
    color: var(--text-muted);
    max-width: 620px;
    line-height: 1.7;
    margin-bottom: 36px;
  }

  .bio strong {
    color: var(--text);
    font-weight: 600;
  }

  .links {
    display: flex;
    gap: 20px;
    margin-top: 48px;
    flex-wrap: wrap;
  }

  .links a {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
  }
  .links a:hover { color: var(--text); }
  .links a::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
  }

  .divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 40px 0;
  }

  /* ─── Section ─── */
  .section { margin-bottom: 52px; }

  .section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
  }

  .section-number {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent);
    font-style: italic;
    min-width: 22px;
  }

  .section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 8px;
  }

  /* ─── Skill Items ─── */
  .skills {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .skill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s, transform 0.3s;
  }

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

  .skill.primary {
    border-left: 3px solid var(--accent);
    background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 60%);
  }
  .skill.primary:hover {
    background: linear-gradient(135deg, var(--accent-glow) 0%, var(--surface-hover) 60%);
  }

  .skill-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }

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

  .skill-name {
    font-weight: 650;
    font-size: 0.92rem;
    color: var(--text);
  }

  .skill-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.65;
    padding-left: 20px;
  }

  .evidence {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-left: 20px;
  }

  .ev {
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: border-color 0.2s;
  }

  a.ev:hover { border-color: var(--text-muted); }

  .ev.repo {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    background: var(--accent-soft);
  }

  .ev.repo.private {
    border-style: dashed;
    opacity: 0.75;
  }

  .ev.repo.private::after {
    content: ' 🔒';
    font-size: 0.6rem;
  }

  .ev.pub {
    color: var(--green);
    border-color: color-mix(in srgb, var(--green) 30%, transparent);
    background: var(--green-soft);
  }

  .ev.tool {
    color: var(--blue);
    border-color: color-mix(in srgb, var(--blue) 30%, transparent);
    background: var(--blue-soft);
  }

  .ev.concept {
    color: var(--amber);
    border-color: color-mix(in srgb, var(--amber) 30%, transparent);
    background: var(--amber-soft);
  }

  .ev.upskilling {
    color: var(--white);
    border-color: color-mix(in srgb, var(--white) 30%, transparent);
    background: var(--white-soft);
  }

  .ev.community {
    color: var(--orange);
    border-color: color-mix(in srgb, var(--orange) 30%, transparent);
    background: var(--orange-soft);
  }

  .ev.teaching {
    color: var(--purple);
    border-color: color-mix(in srgb, var(--purple) 30%, transparent);
    background: var(--purple-soft);
  }

  .ev.writing {
    color: var(--teal);
    border-color: color-mix(in srgb, var(--teal) 30%, transparent);
    background: var(--teal-soft);
  }

  /* ─── Legend ─── */
  .legend {
    display: flex;
    gap: 20px;
    margin-bottom: 36px;
    flex-wrap: wrap;
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
  }

  .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 3px;
  }

  /* ─── News ─── */
  .news-scroll {
    max-height: 360px;
    overflow-y: auto;
    padding: 0 10px 28px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
    mask-image: linear-gradient(to bottom, #000 82%, transparent);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .news-scroll:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
  .news-scroll::-webkit-scrollbar { width: 6px; }
  .news-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  .news-list { list-style: none; display: flex; flex-direction: column; }

  .news-item {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: baseline;
  }

  .news-item:last-child { border-bottom: none; }


  .news-date {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
  }

  .news-text { font-size: 0.86rem; color: var(--text-muted); line-height: 1.6; }
  .news-text strong { color: var(--text); font-weight: 600; }
  .news-text a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    transition: border-color 0.2s;
  }
  .news-text a:hover { border-bottom-color: var(--accent); }

  /* ─── Education ─── */
  

  .edu-list {
    border-left: 1px solid var(--border);
    margin-left: 4px;
    display: flex;
    flex-direction: column;
    gap: 22px;
  }

  .edu-item { position: relative; padding-left: 24px; }

  .edu-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 4px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
  }

  .edu-degree { font-weight: 600; font-size: 0.95rem; color: var(--text); }

  .edu-years {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2px;
  }

  .edu-school { font-size: 0.84rem; color: var(--text-muted); }

  .edu-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 6px;
    max-width: 620px;
  }

  .edu-detail a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  }

  .edu-school a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  }

  /* ─── Tag cloud (skills) ─── */
  .tag-cloud { display: flex; flex-direction: column; gap: 14px; }

  .tag-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: baseline;
  }

  .tag-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
  }

  .tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

  @media (max-width: 640px) {
    .tag-row { grid-template-columns: 1fr; gap: 6px; }
    .news-item { grid-template-columns: 1fr; gap: 2px; }
    .research-title { font-size: 2rem; }
    .skill { padding: 16px 14px; }
    .skill-desc, .evidence { padding-left: 0; }
    h1 { font-size: 3rem; }
    .subtitle { font-size: 1rem; }
    nav .nav-links { gap: 16px; }
  }

  /* ─── Page anchors ─── */
  [id] { scroll-margin-top: 96px; }
  html { scroll-behavior: smooth; }

  /* ─── Table of contents ─── */
  .toc {
    position: sticky;
    top: 110px;
    align-self: start;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    padding-top: 22px;
  }

  .toc-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
  }

  .toc ul { list-style: none; }

  .toc-page { margin-bottom: 10px; }

  .toc-page > a {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }
  .toc-page > a:hover, .toc-page.current > a { color: var(--text); }

  .toc-sub {
    margin: 8px 0 4px;
    border-left: 1px solid var(--border);
  }

  .toc-sub a {
    display: block;
    font-size: 0.74rem;
    line-height: 1.4;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 0 4px 12px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
  }
  .toc-sub a:hover { color: var(--text); }
  .toc-sub a.active { color: var(--accent); border-left-color: var(--accent); }

  @media (max-width: 960px) {
    .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 90px 16px 0; }
    .toc {
      position: static;
      max-height: none;
      overflow: visible;
      padding: 0 0 18px;
      margin-bottom: 12px;
      border-bottom: 1px solid var(--border);
    }
    .toc-pages > li:not(.current) { display: none; }
    .toc-page.current > a { display: none; }
    .toc-sub { display: flex; flex-wrap: wrap; gap: 6px; border-left: none; margin: 0; }
    .toc-sub a {
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 4px 12px;
      margin: 0;
    }
    .toc-sub a.active { border-color: var(--accent); }
  }

  @media (max-width: 640px) {
    nav .nav-inner { padding: 18px 16px; }
    nav .nav-links { gap: 12px; }
    nav a { font-size: 0.76rem; }
    nav .nav-gh { display: none; }
    nav .nav-inner { gap: 16px; }
    nav .nav-links {
      overflow-x: auto;
      white-space: nowrap;
      scrollbar-width: none;
      -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
      mask-image: linear-gradient(to right, #000 88%, transparent);
      padding-right: 16px;
    }
    nav .nav-links::-webkit-scrollbar { display: none; }
    .news-scroll { max-height: 420px; }
  }

  /* ─────────────────────────────────────────────
     Ghibli touches
     ───────────────────────────────────────────── */

  /* Sky, drifting clouds and hills (light) / hearth glow (dark) */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
      radial-gradient(ellipse 90px 26px at 8% 70px, var(--cloud) 60%, transparent 62%),
      radial-gradient(ellipse 56px 30px at 11% 56px, var(--cloud) 60%, transparent 62%),
      radial-gradient(ellipse 110px 30px at 62% 96px, var(--cloud) 60%, transparent 62%),
      radial-gradient(ellipse 64px 34px at 66% 80px, var(--cloud) 60%, transparent 62%),
      radial-gradient(ellipse 70px 20px at 92% 150px, var(--cloud) 55%, transparent 60%),
      linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 38%, var(--bg) 72%);
    background-size: 1400px 100%, 1400px 100%, 1400px 100%, 1400px 100%, 1400px 100%, 100% 100%;
    background-repeat: repeat-x;
    animation: drift 160s linear infinite;
  }

  body::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(ellipse 60% 90px at 20% 140px, var(--hill-near) 98%, transparent 100%),
      radial-gradient(ellipse 55% 110px at 85% 150px, var(--hill-far) 98%, transparent 100%);
    opacity: 0.55;
  }

  @keyframes drift {
    from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    to   { background-position: 1400px 0, 1400px 0, 1400px 0, 1400px 0, 1400px 0, 0 0; }
  }

  :root[data-theme="dark"] body::before {
    background:
      radial-gradient(ellipse 70% 45% at 50% 108%, rgba(255, 110, 30, 0.22), transparent 70%),
      radial-gradient(ellipse 40% 25% at 50% 104%, rgba(255, 190, 80, 0.16), transparent 70%),
      radial-gradient(1px 1px at 18% 12%, rgba(255, 230, 200, 0.6), transparent),
      radial-gradient(1px 1px at 64% 8%, rgba(255, 230, 200, 0.5), transparent),
      radial-gradient(1px 1px at 86% 26%, rgba(255, 230, 200, 0.4), transparent),
      linear-gradient(to bottom, var(--sky-top), var(--bg) 60%);
    animation: hearth 5s ease-in-out infinite alternate;
  }

  /* Rising embers */
  :root[data-theme="dark"] body::after {
    top: 0;
    height: auto;
    opacity: 0.8;
    background:
      radial-gradient(2px 2px at 40px 520px, var(--ember), transparent),
      radial-gradient(1.5px 1.5px at 190px 380px, var(--ember), transparent),
      radial-gradient(2px 2px at 310px 610px, #ff7a1a, transparent),
      radial-gradient(1.5px 1.5px at 260px 180px, var(--ember), transparent),
      radial-gradient(2px 2px at 120px 90px, #ff7a1a, transparent);
    background-size: 380px 700px;
    animation: embers 18s linear infinite;
  }

  @keyframes hearth {
    from { filter: brightness(0.92); }
    to   { filter: brightness(1.08); }
  }

  @keyframes embers {
    from { background-position: 0 0; }
    to   { background-position: 60px -700px; }
  }

  /* Cards feel like paper (light) and catch firelight (dark) */
  .skill { box-shadow: var(--shadow); }
  .skill:hover { box-shadow: var(--shadow-hover); }

  :root[data-theme="dark"] .edu-item::before {
    box-shadow: 0 0 8px 1px rgba(255, 138, 61, 0.7);
  }

  :root[data-theme="dark"] h1 {
    text-shadow: 0 0 28px rgba(255, 138, 61, 0.25);
  }

  ::selection { background: var(--accent-glow); }

  /* ─── Sprite logo ─── */
  nav .logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .sprite {
    display: block;
    image-rendering: pixelated;
    transition: transform 0.25s;
  }

  .sprite-night { display: none; }
  :root[data-theme="dark"] .sprite-day { display: none; }
  :root[data-theme="dark"] .sprite-night { display: inline; }

  .sprite .f2 { opacity: 0; }

  /* Bicycle: wheels turn while hovered, and it rolls forward a little */
  nav .logo:hover .sprite-day .f1,
  nav .logo:focus-visible .sprite-day .f1 { animation: frame 0.3s steps(1, end) infinite; }
  nav .logo:hover .sprite-day .f2,
  nav .logo:focus-visible .sprite-day .f2 { animation: frame 0.3s steps(1, end) -0.15s infinite; }
  nav .logo:hover .sprite { transform: translateX(3px); }

  /* Fire spirit: always flickering, brighter on hover */
  :root[data-theme="dark"] .sprite-night .f1 { animation: frame 0.7s steps(1, end) infinite; }
  :root[data-theme="dark"] .sprite-night .f2 { animation: frame 0.7s steps(1, end) -0.35s infinite; }
  :root[data-theme="dark"] .sprite { filter: drop-shadow(0 0 6px rgba(255, 138, 61, 0.55)); }
  :root[data-theme="dark"] nav .logo:hover .sprite {
    transform: scale(1.12);
    filter: drop-shadow(0 0 10px rgba(255, 160, 60, 0.9));
  }

  @keyframes frame {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
  }

  /* ─── Theme toggle ─── */
  .theme-toggle {
    position: relative;
    flex-shrink: 0;
    width: 50px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: linear-gradient(to bottom, #a9d4ee, #e3f1f8);
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
  }

  .theme-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffd36b;
    box-shadow: 0 0 0 3px rgba(255, 211, 107, 0.35);
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
  }

  :root[data-theme="dark"] .theme-toggle {
    background: linear-gradient(to bottom, #241a2a, #2b1a12);
  }

  :root[data-theme="dark"] .theme-toggle::after {
    transform: translateX(24px);
    background: radial-gradient(circle at 50% 65%, #ffe08a 0 25%, #ff8a3d 55%, #e0472b 100%);
    box-shadow: 0 0 10px 2px rgba(255, 120, 40, 0.6);
  }

  .theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  nav .nav-links { margin-left: auto; min-width: 0; }
  nav .nav-inner { gap: 24px; }

  @media (max-width: 960px) {
    body::after { height: 60px; opacity: 0.35; }
  }

  @media (prefers-reduced-motion: reduce) {
    body::before, body::after,
    :root[data-theme="dark"] body::before,
    :root[data-theme="dark"] body::after,
    .sprite .f1, .sprite .f2 { animation: none !important; }
    .sprite .f1 { opacity: 1 !important; }
    .sprite .f2 { opacity: 0 !important; }
  }
