:root {
  color-scheme: light;
  --page: #f4f0e7;
  --ink: #1d1b20;
  --muted: #69656b;
  --paper: rgba(255, 255, 255, .78);
  --line: rgba(29, 27, 32, .14);
  --shadow: 0 22px 60px rgba(45, 39, 34, .12);
  --radius: 30px;
  --font-sans: "Alegreya Sans", sans-serif;
  --font-small-caps: "Alegreya Sans SC", "Alegreya Sans", sans-serif;
  --font-serif: "Alegreya", serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.dark {
  color-scheme: dark;
  --page: #151515;
  --ink: #f5f0e7;
  --muted: #b7b1aa;
  --paper: rgba(34, 34, 33, .86);
  --line: rgba(255, 255, 255, .14);
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

html[lang="zh-CN"] {
  --font-serif: "Noto Serif SC", "Songti SC", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; transition: background-color .42s ease; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(184, 205, 88, .13), transparent 24rem),
    radial-gradient(circle at 88% 35%, rgba(101, 80, 126, .10), transparent 28rem),
    var(--page);
  font-family: var(--font-sans);
  line-height: 1.45;
  transition: color .42s ease, background .48s ease;
}
button, a { font: inherit; }
a { color: inherit; }
button { color: inherit; }

.floating-header {
  position: fixed;
  z-index: 100;
  top: 18px;
  left: max(20px, calc((100vw - 1240px) / 2));
  width: auto;
  min-height: 62px;
  padding: 8px 10px 8px 12px;
  display: flex;
  align-items: center;
  gap: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 12px 34px rgba(29, 27, 32, .09);
  backdrop-filter: blur(18px) saturate(1.2);
  font-family: var(--font-ui);
  transition: color .4s ease, background-color .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.brand { display: inline-flex; align-items: center; gap: 9px; width: max-content; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--page); font-family: var(--font-ui); font-style: normal; font-weight: 800; transition: color .4s ease, background-color .4s ease; }
.main-nav { display: flex; align-items: center; gap: 5px; font-family: var(--font-ui); font-size: .9rem; font-weight: 400; letter-spacing: -.01em; }
.main-nav > a, .nav-menu > button { padding: 10px 14px; border: 0; border-radius: 999px; background: transparent; text-decoration: none; cursor: pointer; }
.nav-menu > button { display: inline-flex; align-items: center; gap: 5px; line-height: 1; }
.nav-menu > button span[aria-hidden="true"] { display: inline-grid; place-items: center; line-height: 1; transform: translateY(-3px); }
.main-nav > a:hover, .main-nav > a:focus-visible, .nav-menu > button:hover, .nav-menu > button:focus-visible, .main-nav .is-current { background: rgba(128, 123, 115, .12); }
.utility-controls { position: fixed; z-index: 100; top: 28px; right: max(20px, calc((100vw - 1240px) / 2)); display: flex; gap: 8px; }
.theme-button, .language-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); box-shadow: 0 12px 34px rgba(29, 27, 32, .09); backdrop-filter: blur(18px) saturate(1.2); cursor: pointer; transition: color .4s ease, background-color .4s ease, border-color .4s ease, box-shadow .4s ease, transform .2s ease; }
.language-button { font-family: var(--font-ui); font-size: .72rem; font-weight: 800; letter-spacing: -.02em; }
.theme-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-menu { position: relative; }
.tool-menu { position: absolute; top: calc(100% + 22px); left: 50%; z-index: 10; display: grid; justify-items: center; gap: 8px; width: max-content; padding: 0; border: 0; background: transparent; box-shadow: none; transform: translateX(-50%); }
.tool-menu a { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 220px; max-width: calc(100vw - 32px); padding: 10px 17px; border: 1px solid color-mix(in srgb, var(--pill-color) 55%, white); border-radius: 999px; background: color-mix(in srgb, var(--pill-color) 90%, transparent); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--pill-color) 30%, transparent); backdrop-filter: blur(20px) saturate(1.2); font-family: var(--font-ui); font-weight: 600; letter-spacing: -.015em; line-height: 1.1; text-align: center; text-decoration: none; opacity: 0; transform: translateY(-7px) scale(.97); transition: filter .18s ease, background-color .22s ease, border-color .22s ease, box-shadow .22s ease; animation: pill-arrive .26s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--pill-index) * 55ms); }
.tool-menu a:hover, .tool-menu a:focus-visible { filter: saturate(1.15) brightness(1.08); background: color-mix(in srgb, var(--pill-color) 88%, transparent); border-color: color-mix(in srgb, var(--pill-color) 35%, white); box-shadow: 0 12px 30px color-mix(in srgb, var(--pill-color) 38%, transparent); }
.tool-menu a::after { content: attr(data-tip); position: absolute; top: 50%; left: calc(100% + 10px); z-index: 20; width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--paper) 88%, var(--page)); color: var(--ink); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(1.15); font-family: var(--font-ui); font-size: .77rem; font-weight: 400; letter-spacing: 0; line-height: 1.35; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-5px, -50%); transition: opacity .18s ease, transform .18s ease, color .4s ease, background-color .4s ease, border-color .4s ease; }
.tool-menu a:hover::after, .tool-menu a:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.tool-menu p { margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted); box-shadow: var(--shadow); font-family: var(--font-serif); font-size: 1.04rem; transition: color .4s ease, background-color .4s ease, border-color .4s ease; }
@keyframes pill-arrive { to { opacity: 1; transform: translateY(0) scale(1); } }

main { width: min(1180px, calc(100vw - 40px)); margin: 0 auto; }
.intro { min-height: 76vh; padding: 168px 3vw 90px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.eyebrow { margin: 0 0 22px; font-family: var(--font-small-caps); font-size: .96rem; font-weight: 800; letter-spacing: .07em; }
.intro h1 { max-width: 920px; margin: 0; font-size: clamp(4rem, 9.5vw, 8.3rem); font-weight: 760; line-height: .9; letter-spacing: -.025em; }
.intro h1 em { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.02em; }
html[lang="zh-CN"] .intro h1 em { font-family: "Noto Serif SC", "Songti SC", serif; font-style: normal; font-weight: 300; letter-spacing: .01em; }
html[lang="zh-CN"] .intro h1 { font-size: clamp(3rem, 12vw, 8.3rem); }
html[lang="zh-CN"] .intro h1 em { display: inline-block; white-space: nowrap; }
.intro-copy { max-width: 540px; margin: 32px 0 22px auto; color: var(--muted); font-family: var(--font-serif); font-size: clamp(1.15rem, 2vw, 1.55rem); }
.down-link { margin-left: auto; padding-bottom: 4px; border-bottom: 1px solid; text-decoration: none; font-weight: 750; }

.bento {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  height: clamp(670px, calc(100svh - 104px), 820px);
  gap: 16px;
  scroll-margin-top: 94px;
}
.tool-card {
  position: relative;
  min-height: 0;
  padding: clamp(24px, 3vw, 38px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: var(--radius);
  color: var(--card-ink);
  background: var(--card);
  box-shadow: inset 0 1px rgba(255,255,255,.24), 0 10px 32px rgba(34,28,28,.07);
  text-decoration: none;
  transition: transform .28s ease, box-shadow .28s ease;
}
.tool-card:hover { transform: translateY(-5px); box-shadow: inset 0 1px rgba(255,255,255,.28), 0 24px 48px rgba(34,28,28,.16); }
.tool-card:focus-visible { outline: 4px solid var(--ink); outline-offset: 4px; }
.tool-card.seeker { grid-column: 1 / span 5; grid-row: 1 / span 3; }
.tool-card.keeper { grid-column: 6 / span 5; grid-row: 1; }
.tool-card.weaver { grid-column: 11 / span 4; grid-row: 1; }
.tool-card.didactylo { grid-column: 6 / span 4; grid-row: 2; }
.tool-card.motlong { grid-column: 10 / span 5; grid-row: 2; }
.tool-card.conjugaix { grid-column: 6 / span 5; grid-row: 3; }
.tool-card.passe-simple { grid-column: 11 / span 4; grid-row: 3; }
.tool-top { position: absolute; z-index: 3; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.audience { padding: 7px 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .2); font-family: var(--font-small-caps); font-size: .84rem; font-weight: 600; letter-spacing: .04em; opacity: .92; backdrop-filter: blur(6px); }
.arrow { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; background: rgba(255,255,255,.24); font-family: Inter, Arial, sans-serif; font-size: 1.25rem; font-variant-emoji: text; line-height: 1; transition: transform .25s ease; }
.tool-card:hover .arrow { transform: translate(3px, -3px); }
.tool-copy { position: absolute; z-index: 2; left: clamp(24px, 3vw, 38px); right: clamp(24px, 3vw, 38px); bottom: clamp(24px, 3vw, 38px); }
.tool-copy h2 { margin: 0 0 5px; font-size: clamp(2.15rem, 3.25vw, 3.9rem); line-height: .96; letter-spacing: -.012em; }
.tool-copy p { max-width: 580px; margin: 0; font-family: var(--font-serif); font-size: clamp(1.1rem, 1.32vw, 1.26rem); line-height: 1.25; letter-spacing: .005em; opacity: .94; }
.keeper .tool-copy h2, .weaver .tool-copy h2, .didactylo .tool-copy h2, .conjugaix .tool-copy h2, .passe-simple .tool-copy h2 { font-size: clamp(1.95rem, 2.5vw, 2.9rem); }
.motlong .tool-copy h2 { font-size: clamp(2.05rem, 2.7vw, 3.2rem); }
.motif { position: absolute; z-index: 1; pointer-events: none; transition: transform .35s ease; }
.tool-card:hover .motif { transform: translateY(-4px) rotate(-1deg); }

.seeker .motif { top: 20%; right: 5%; width: 50%; display: grid; gap: 10px; }
.search-box { padding: 12px 13px; border-radius: 15px; background: rgba(255,255,255,.87); color: #3c3048; box-shadow: 0 12px 28px rgba(45,31,57,.16); }
.search-line { display: flex; gap: 7px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid rgba(69,53,93,.18); }
.search-line b { flex: 1; font-family: var(--font-serif); font-size: 1.02rem; }
.result-line { display: grid; grid-template-columns: 1fr auto; gap: 5px; padding-top: 8px; font-size: .68rem; }
.result-line span { grid-column: 1 / -1; height: 6px; border-radius: 9px; background: #dce59c; }
.keeper .motif { top: 25%; right: -7%; width: 74%; display: grid; gap: 5px; transform: rotate(3deg); opacity: .66; }
.keeper .sheet { width: max-content; max-width: 100%; height: 28px; justify-self: end; padding: 6px 9px; border-radius: 8px; background: rgba(255,255,255,.72); color: #3f5319; font-size: .64rem; white-space: nowrap; box-shadow: 0 5px 15px rgba(56,72,17,.1); }
.keeper .sheet:nth-child(2) { transform: translateX(-20px); }
.keeper .flag { color: #9b3028; text-decoration: underline wavy; text-decoration-thickness: 2px; }
.weaver .motif { top: 22%; right: -4%; width: 73%; display: flex; align-items: center; gap: 9px; opacity: .68; }
.grammar-marks { display: grid; gap: 4px; color: rgba(255,255,255,.82); font-family: var(--font-ui); font-size: .8rem; font-style: normal; font-weight: 800; letter-spacing: .025em; line-height: .9; white-space: nowrap; }
.thread-group { display: flex; flex: 1; min-width: 0; height: 80px; align-items: center; }
.thread { flex: 0 0 44%; height: 76px; border: 4px solid rgba(255,255,255,.6); border-radius: 50%; transform: rotate(24deg); }
.thread:nth-child(2) { transform: translateX(-22px) rotate(-24deg) scaleY(.86); }
.thread:nth-child(3) { transform: translateX(-44px) rotate(30deg) scaleX(.84); }
.didactylo .motif { top: 24%; right: 5%; display: grid; grid-template-columns: repeat(3, 30px); gap: 5px; transform: rotate(-4deg); opacity: .68; }
.key { display: grid; place-items: center; aspect-ratio: 1; border-radius: 11px; background: #fff9e9; color: #0b5d56; box-shadow: 0 5px 0 rgba(6,65,59,.28); font-weight: 900; }
.conjugaix .motif { top: 25%; right: 5%; width: 50%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; opacity: .68; }
.verb-cell { padding: 5px; border-radius: 7px; background: rgba(255,248,240,.82); color: #731d19; font-family: var(--font-serif); font-size: .63rem; }
.passe-simple .motif { top: 25%; right: 2%; width: 47%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; opacity: .72; transform: rotate(1deg); }
.tense-line { padding: 4px 6px; border-radius: 7px; background: rgba(255, 251, 232, .78); color: #223a2b; font-family: var(--font-serif); font-size: .61rem; white-space: nowrap; }
.tense-line:nth-child(2) { transform: none; }
.motlong .motif { top: 22%; right: 8%; display: grid; grid-template-columns: repeat(4, 39px); gap: 7px; transform: rotate(3deg); }
.letter { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; background: #f8f1dc; color: #183347; box-shadow: 0 5px 0 #c9bfa4; font-size: 1.35rem; font-weight: 900; }

.about { margin: 120px 0 70px; padding: 70px 3vw; display: grid; grid-template-columns: 1fr 2fr; gap: 50px; border-top: 1px solid var(--line); }
.about h2 { max-width: 760px; margin: 0 0 20px; font-size: clamp(2.3rem, 5vw, 4.8rem); line-height: 1; letter-spacing: -.018em; }
html[lang="zh-CN"] .about h2 { white-space: pre-line; }
.about div p { max-width: 650px; color: var(--muted); font-family: var(--font-serif); font-size: 1.2rem; }
.about .about-status { grid-column: 1 / -1; justify-self: center; max-width: 900px; margin: 28px 0 0; color: var(--muted); font-family: var(--font-small-caps); font-size: 2rem; font-weight: 600; line-height: 1.15; letter-spacing: 0; text-align: center; }
footer { width: min(1180px, calc(100vw - 40px)); margin: auto; padding: 26px 0 42px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--font-ui); font-size: .9rem; letter-spacing: -.01em; transition: color .4s ease, border-color .4s ease; }
footer a { font-weight: 800; text-decoration: none; }
footer p { margin: 0; }
.notice { position: fixed; z-index: 200; left: 50%; bottom: 28px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--page); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: .25s ease; }
.notice.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 850px) {
  main, footer { width: min(100% - 56px, 1180px); }
  .floating-header { right: auto; width: max-content; max-width: calc(100vw - 144px); gap: 12px; }
  .floating-header .brand > span:last-child { display: none; }
  .main-nav > a, .nav-menu > button { padding-inline: 11px; }
  .main-nav { justify-self: end; }
  .utility-controls { top: 27px; right: 20px; }
  .intro { min-height: 70vh; padding-top: 145px; }
  .intro-copy, .down-link { margin-left: 0; }
  .bento { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: 115px; height: auto; }
  .tool-card, .tool-card.seeker, .tool-card.keeper, .tool-card.weaver, .tool-card.didactylo, .tool-card.conjugaix, .tool-card.passe-simple, .tool-card.motlong { grid-column: span 1; grid-row: span 3; }
  .tool-card.seeker { grid-column: span 2; grid-row: span 4; }
  .tool-card .motif { opacity: .75; scale: 1.12; transform-origin: top right; }
  .tool-menu a::after { display: none; }
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main, footer { width: min(100% - 40px, 1180px); }
  .floating-header { left: 10px; right: auto; width: max-content; max-width: calc(100vw - 114px); top: 10px; min-height: 56px; gap: 5px; padding: 7px 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand > span:last-child { display: none; }
  .utility-controls { top: 16px; right: 10px; gap: 6px; }
  .theme-button, .language-button { width: 40px; height: 40px; }
  .main-nav { position: static; width: max-content; min-width: 0; justify-content: flex-start; gap: 0; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: clamp(.66rem, 3vw, .82rem); }
  .main-nav > a, .nav-menu > button { padding: 8px clamp(4px, 1.45vw, 8px); white-space: nowrap; }
  .tool-menu { top: calc(100% + 22px); }
  .bento { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .tool-card, .tool-card.seeker, .tool-card.keeper, .tool-card.weaver, .tool-card.didactylo, .tool-card.conjugaix, .tool-card.passe-simple, .tool-card.motlong { grid-column: 1; grid-row: auto; min-height: 390px; }
  .tool-card.weaver { min-height: 320px; }
  .tool-card .motif { top: 27%; scale: 1.18; transform-origin: top right; }
  .tool-copy h2 { font-size: 2.7rem; }
  .about { margin-top: 80px; padding-inline: 10px; }
  footer { display: grid; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
