:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #2f2923;
  background: #f7f3e9;
  --ink: #2f2923;
  --muted: #6f5f52;
  --paper: #f7f3e9;
  --surface: #fffaf0;
  --line: #ded0bd;
  --red: #8d372d;
  --green: #354d44;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", SimSun, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 0; margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
p, h1, h2, h3 { margin: 0; }
p { line-height: 1.6; }
h1, h2, h3 { line-height: 1.3; }
h1 { font-family: var(--serif); font-size: clamp(2rem, 8vw, 2.65rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app {
  width: min(100%, 56rem);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding: calc(.7rem + env(safe-area-inset-top)) max(.95rem, env(safe-area-inset-right)) calc(5.35rem + env(safe-area-inset-bottom)) max(.95rem, env(safe-area-inset-left));
}
.welcome-screen .app { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.app-header {
  min-height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding-bottom: .4rem;
  margin-bottom: .65rem;
  border-bottom: 1px solid var(--line);
}
.brand, .header-tools { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.brand { min-height: 44px; }
.brand img { display: block; border-radius: 10px; }
.profile-link { display: inline-grid; place-items: center; min-height: 44px; color: var(--muted); font-size: .9rem; }
.connection { color: var(--red); font-size: .85rem; }

.overline {
  color: var(--red);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .12em;
}
.rh-primary, .rh-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  font-weight: 700;
}
.rh-primary { color: #fffaf0; background: var(--red); }
.rh-text { color: var(--red); background: transparent; }
.rh-primary:hover { background: #713027; }
.rh-text:hover { background: #eee3d2; }

.welcome {
  display: grid;
  width: min(100%, 23rem);
  margin: 0 auto;
  padding: clamp(1rem, 5vh, 2.9rem) .2rem 0;
  gap: 1rem;
}
.welcome-title h1 { font-size: clamp(2rem, 8vw, 2.6rem); margin-top: .55rem; }
.welcome-subtitle { color: var(--muted); margin-top: .65rem; }
.welcome-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(8rem, 25vh, 13.5rem);
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #d9ba90;
  border-radius: 1rem;
  background: radial-gradient(ellipse at center, #f2d9a8, #e5c08a);
}
.welcome-art::before, .home-hero::before {
  position: absolute;
  z-index: -1;
  content: "";
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 14px, currentColor 14px 15px, transparent 15px 30px),
    repeating-linear-gradient(-45deg, transparent 0 14px, currentColor 14px 15px, transparent 15px 30px);
  opacity: .13;
  mask-image: linear-gradient(120deg, transparent 3%, #000 58%);
}
.welcome-form { display: grid; gap: .6rem; }
.welcome-form h2 { font-family: var(--serif); margin-block: .2rem .25rem; }
.welcome-form input, .home-dialog input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  color: var(--ink);
  background: var(--surface);
  font-size: 1rem;
}

.fangsheng-mark {
  --size: 4.2rem;
  position: relative;
  width: calc(var(--size) * 2.08);
  height: calc(var(--size) * 1.42);
  color: inherit;
  flex: none;
}
.fangsheng-mark i {
  position: absolute;
  top: 14.5%;
  left: 10%;
  width: var(--size);
  height: var(--size);
  border: .24rem double currentColor;
  transform: rotate(45deg);
}
.fangsheng-mark i:nth-child(2) { left: 42%; }
.fangsheng-mark b {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  top: 42%;
  left: 44%;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}
.welcome-mark { --size: clamp(3.8rem, 19vw, 5.4rem); color: var(--red); }

.home { display: grid; gap: 1rem; }
.home-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .4rem .1rem; }
.home-heading h1 { margin-top: .1rem; }
.search-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}
.search-button span { width: 14px; height: 14px; border: 1.5px solid var(--ink); border-radius: 50%; position: relative; }
.search-button span::after { content: ""; width: 7px; height: 1.5px; position: absolute; top: 10px; left: 9px; transform: rotate(45deg); transform-origin: left; background: var(--ink); }
.home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 10.2rem;
  padding: 1.05rem 1rem;
  border: 1px solid #722b25;
  border-radius: .85rem;
  background: linear-gradient(125deg, #7e2e26, #9c3f32 74%, #aa523a);
  color: #fff3de;
  text-align: left;
}
.hero-copy { position: relative; z-index: 1; display: grid; gap: .5rem; }
.hero-copy > span { font-size: .85rem; }
.hero-copy > strong { font: 700 clamp(1.55rem, 7vw, 2.25rem) / 1.2 var(--serif); letter-spacing: .045em; }
.hero-mark { --size: clamp(2.65rem, 16vw, 6rem); position: absolute; right: 3%; top: 50%; transform: translateY(-50%) rotate(-10deg); color: #efca88; opacity: .88; }
.shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
.shortcut {
  display: grid;
  place-items: center;
  gap: .15rem;
  min-height: 4.65rem;
  padding: .4rem .15rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: #f0e3cc;
  color: #523a2b;
  font-size: clamp(.68rem, 3.2vw, .875rem);
  text-align: center;
}
.shortcut strong { font: 700 1.5rem / 1.1 var(--serif); }
.shortcut-journey { background: #e2e8db; color: #344d42; }
.shortcut-patterns { background: #f3ddd2; color: #79372b; }
.shortcut-games { background: #eae0ef; color: #594260; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .45rem; }
.section-heading h2 { font-family: var(--serif); }
.section-heading .rh-text { padding-inline: .7rem; white-space: nowrap; }
.lesson-list { display: grid; gap: .6rem; }
.lesson-card {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 6.05rem;
  padding: .65rem .85rem;
  background: #f2e5d0;
  border: 1px solid var(--line);
  border-radius: .7rem;
  overflow: hidden;
}
.lesson-card:nth-child(even) { background: #e9ebe0; }
.lesson-copy { flex: 1; min-width: 0; position: relative; z-index: 1; }
.lesson-category { color: #685443; font-size: .77rem; font-weight: 600; }
.lesson-card h3 { margin-top: .15rem; }
.lesson-card p { font-size: .86rem; color: var(--muted); margin-top: .2rem; }
.lesson-sign { color: #8d372d30; font: 700 3rem / 1 var(--serif); }
.rh-arrow { font-size: 1.65rem; color: var(--red); }

.lesson-view, .profile { max-width: 42rem; margin-inline: auto; }
.lesson-view h1, .profile h1 { margin-top: .3rem; }
.lesson-view .back { padding-left: 0; margin-bottom: .55rem; }
.lesson-intro { margin-block: .7rem 1rem; color: var(--muted); }
.lesson-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 9rem;
  padding: .85rem;
  background: #e7dfc9;
  border: 1px solid var(--line);
  border-radius: .8rem;
  color: #70513b;
  overflow: hidden;
}
.lesson-banner p:last-child { color: var(--ink); font-family: var(--serif); font-weight: 750; margin-top: .4rem; }
.lesson-mark { --size: clamp(2rem, 9.5vw, 4.5rem); }
.lesson-details { display: grid; gap: .7rem; margin-block: 1rem; }
.lesson-details section, .profile-summary {
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .7rem;
}
.lesson-details p, .profile-summary > p { margin-top: .4rem; color: var(--muted); }
.profile-summary { margin-block: 1rem; }
.profile-summary h2 { overflow-wrap: anywhere; }
.profile-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: .9rem 0 0; }
.profile-counts dt { font-size: .85rem; color: var(--muted); }
.profile-counts dd { margin: .1rem 0 0; color: var(--red); font-size: 1.35rem; font-weight: 750; }
.profile-counts dd span { color: var(--muted); font-size: .85rem; }

.home-dialog {
  width: min(calc(100% - 1.5rem), 31rem);
  max-height: calc(100dvh - 2rem);
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
.home-dialog::backdrop { background: #29231cb0; }
.home-dialog input { margin-bottom: .8rem; }
.home-dialog .rh-primary { margin-top: 1rem; }
.dialog-motif { display: grid; place-items: center; padding: .6rem; background: #f1e0c1; color: var(--red); border-radius: .6rem; margin-bottom: .7rem; }

.navigation {
  position: fixed;
  inset: auto 0 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: .4rem max(.55rem, env(safe-area-inset-right)) calc(.4rem + env(safe-area-inset-bottom)) max(.55rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: #fffaf2;
}
.navigation a {
  display: grid;
  place-items: center;
  align-content: center;
  gap: .36rem;
  flex: 0 1 5rem;
  min-height: 48px;
  min-width: 0;
  padding: .3rem .15rem;
  border-radius: .55rem;
  color: var(--muted);
  font-weight: 650;
  font-size: .82rem;
}
.navigation a[aria-current="page"] { color: var(--red); background: #f4e5d4; }
.nav-icon { display: inline-block; width: 13px; height: 13px; border: 1.5px solid currentColor; transform: rotate(45deg); }
.nav-journey { border-radius: 50%; }
.nav-patterns { border-width: 0 2px 2px 0; width: 7px; }
.nav-games { border-radius: 25%; transform: rotate(0); }
.nav-profile { border-radius: 50% 50% 45% 45%; transform: rotate(0); width: 11px; }
.notice:not(:empty) {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: calc(4.4rem + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
  padding: .65rem .85rem;
  border-radius: .55rem;
  background: #412e23;
  color: #fff7e7;
  text-align: center;
}

@media (min-width: 42rem) {
  .app { padding-inline: max(1.4rem, env(safe-area-inset-left)) max(1.4rem, env(safe-area-inset-right)); }
  .home-hero { min-height: 13rem; padding-inline: 1.65rem; }
  .hero-mark { right: 8%; }
  .home > section .lesson-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shortcuts { gap: .7rem; }
}
@media (max-width: 23rem) {
  .hero-mark { opacity: .56; }
  .lesson-sign { font-size: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
