/*
  Top nav shared by every page (hub, TingTing, Jushi): fixed, frosted, collapses
  into a burger below 720px (see nav.js). Only the logo image differs per page;
  app pages set --app-accent on :root to colour the hover underline.
*/
:root { --nav-height: 60px; }
nav {
  --nav-bg: #FFFFFF;
  --nav-border: #E8ECEF;
  --nav-ink: #1A2A44;
  --nav-accent: var(--app-accent, #ca3825);
}
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--nav-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 0;
}
.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 20px;
}
/* Logo stays left; the links are centred in the bar. */
@media (min-width: 721px) {
  .nav-inner { display: grid; grid-template-columns: 1fr auto 1fr; }
}
.nav-logo {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: "Nunito", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
}
.nav-logo img {
  height: 36px;
  width: auto;
  display: block;
  border-radius: 8px;
}
nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
nav ul::-webkit-scrollbar { display: none; }
nav ul a {
  flex: none;
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: "Nunito", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--nav-ink);
  text-decoration: none;
  padding: 12px 10px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}
nav ul a:hover { color: var(--nav-ink); border-bottom-color: var(--nav-accent); }

#nav-toggle {
  display: none;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
#nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--nav-ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
nav.nav-open #nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.nav-open #nav-toggle span:nth-child(2) { opacity: 0; }
nav.nav-open #nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  #nav-toggle { display: flex; }

  nav ul {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--nav-bg);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  nav.nav-open ul {
    max-height: calc(100dvh - var(--nav-height));
    overflow-y: auto;
    border-bottom: 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  }
  nav ul li { width: 100%; }
  nav ul a {
    padding: 14px 20px;
    border-bottom: 1px solid var(--nav-border);
    border-left: 2px solid transparent;
  }
  nav ul a:hover { border-bottom-color: var(--nav-border); border-left-color: var(--nav-accent); }
}

@media (max-width: 520px) {
  .nav-inner { padding: 0 14px; gap: 12px; }
  .nav-logo img { height: 28px; }
}

/*
  Slide-style layout for the app hub (index.html) and the Tingting page.
  Ported from DER-DIE-DAS/website/content.css: one section per screen with
  proximity scroll-snap, alternating section backgrounds like the Jushi page,
  mascot-in-circle heads with entrance animations, a frosted
  fixed nav that collapses into a burger on mobile, pill stats and a
  centred single-column reading width. Tokens use the doudou-chinese.com
  palette (TingTing red primary) instead of the German app's gender colours.
  App detail pages override --accent with their own colour.
*/

:root {
  --bg: #FFFFFF;
  --bg-alt: #F4F3F2;
  --surface: #FFFFFF;
  --border: #E8ECEF;
  --ink: #1A2A44;
  --ink-soft: #9499a4;
  --chip-bg: #F4F3F2;
  --accent: #ca3825;
  --accent-dark: #ca3825;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-card-hover: 0 20px 40px rgba(0, 0, 0, 0.1);

  --font-heading: "Nunito", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Nunito", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-snap-type: y proximity;
  scroll-padding-top: var(--nav-height);
}

@media (max-width: 899.98px) {
  html {
    scroll-snap-type: none;
  }
}

/* The hub, Tingting and the long dictionary pages scroll freely: no section snapping. */
html.hub-page,
html.free-scroll {
  scroll-snap-type: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
}

a:focus-visible,
summary:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}

p {
  margin: 0 0 12px;
}

/* ---------- layout shell ---------- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.container--wide {
  max-width: 1040px;
}

/* Backgrounds like the Jushi page: white header, then sections alternating a
   warm-grey-to-white fade and plain white. */
main>section:nth-of-type(odd) {
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
}

/* The hub's Apps section is grey. */
#apps {
  background: var(--bg-alt);
}

.hub-page body,
.hub-page header,
.hub-page main>section,
.hub-page #apps {
  background: #FFFFFF;
}

/* Scroll reveal (see slides.js): children of each section's .container
   fade/rise in once, staggered, when the slide is ~25% in view. */
main section>.container> :not(.mascot-circle) {
  opacity: 0;
  transform: translateY(36px) scale(0.97);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

main section>.container.is-visible> :not(.mascot-circle) {
  opacity: 1;
  transform: translateY(0) scale(1);
}

main section>.container> :nth-child(1) {
  transition-delay: 0s;
}

main section>.container> :nth-child(2) {
  transition-delay: 0.08s;
}

main section>.container> :nth-child(3) {
  transition-delay: 0.16s;
}

main section>.container> :nth-child(4) {
  transition-delay: 0.24s;
}

main section>.container> :nth-child(5) {
  transition-delay: 0.32s;
}

/* ---------- mascot entrance effects ---------- */
main section>.container .mascot-circle {
  opacity: 0;
}

.container.is-visible .mascot-circle.fx-roll-left {
  animation: fx-roll-left 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.container.is-visible .mascot-circle.fx-roll-right {
  animation: fx-roll-right 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.container.is-visible .mascot-circle.fx-bounce {
  animation: fx-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.container.is-visible .mascot-circle.fx-pulse {
  animation: fx-pulse 0.7s ease-out forwards;
}

.container.is-visible .mascot-circle.fx-spin {
  animation: fx-spin 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fx-roll-left {
  from {
    opacity: 0;
    transform: translateX(-200px) rotate(-260deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes fx-roll-right {
  from {
    opacity: 0;
    transform: translateX(200px) rotate(260deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes fx-bounce {
  0% {
    opacity: 0;
    transform: translateY(-120px) scale(0.7);
  }

  55% {
    opacity: 1;
    transform: translateY(18px) scale(1.05);
  }

  75% {
    opacity: 1;
    transform: translateY(-8px) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fx-pulse {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }

  60% {
    opacity: 1;
    transform: scale(1.25);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fx-spin {
  0% {
    opacity: 0;
    transform: rotate(0deg) scale(0.5);
  }

  60% {
    opacity: 1;
    transform: rotate(370deg) scale(1.05);
  }

  100% {
    opacity: 1;
    transform: rotate(360deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  main section>.container>*,
  main section>.container .mascot-circle {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- header / hero ---------- */
header {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  padding-top: calc(var(--nav-height) + 32px);
  padding-bottom: 28px;
  text-align: center;
}

header .container {
  width: 100%;
}

.mascot-circle {
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mascot-circle img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.mascot-circle--sm {
  width: 118px;
  height: 118px;
  margin-bottom: 16px;
}

/* Keep circles distinct from both colours of the scrolling background. */
main section .mascot-circle {
  background: var(--border);
}

header h1 {
  font-size: clamp(2rem, 6.5vw, 3rem);
  line-height: 1.1;
  margin-bottom: 14px;
}

header h1 small {
  display: block;
  font-size: 0.45em;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 6px;
}

.tagline {
  max-width: 56ch;
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0 auto 24px;
}

.stat-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.stat-list li {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid rgba(110, 106, 101, 0.3);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

header .cta-row {
  justify-content: center;
}

/* ---------- store badges ---------- */
.store-badges a {
  display: inline-block;
  line-height: 0;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-badges img {
  display: block;
  height: 48px;
  width: auto;
}

.store-badges a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* tingting's web version, drawn like the store badges (48px high). */
.store-badges .web-app-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-sizing: border-box;
  height: 48px;
  padding: 0 14px 0 11px;
  border: 1px solid #a6a6a6;
  border-radius: 8px;
  background: #000;
  color: #fff;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.store-badges .web-app-btn svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.store-badges .web-app-btn span {
  font-size: 22px;
}

.store-badges .web-app-btn small {
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 500;
}

/* ---------- sections: one per screen ---------- */
main {
  padding-top: 8px;
  padding-bottom: 40px;
}

section {
  padding: 40px 0;
  scroll-margin-top: calc(var(--nav-height) + 12px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

section>.container {
  width: 100%;
}

section h2 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1;
  margin: 0 0 2.5rem;
  text-align: center;
}

section>.container>p:not(.cta-row) {
  max-width: 66ch;
  color: var(--ink-soft);
}

#download,
#about,
#contact {
  text-align: center;
}

#about>.container>p,
#contact>.container>p {
  margin-left: auto;
  margin-right: auto;
}

/* About Us: our portrait drawing, cropped to a larger circle and nudged up (zoomed so it still fills it). */
#about .mascot-circle {
  width: 180px;
  height: 180px;
  overflow: hidden;
}

#about .mascot-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% center;
  transform: translateY(-3%) scale(1.06);
}

#download .cta-row {
  justify-content: center;
}

dl {
  margin: 0;
}

dt {
  font-weight: 800;
  color: var(--ink);
  margin-top: 18px;
  text-align: center;
}

dt:first-child {
  margin-top: 0;
}

dd {
  margin: 4px auto 0;
  color: var(--ink-soft);
  max-width: 62ch;
  text-align: center;
}

/* ---------- card grid (apps / tools / blog / plans) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px dashed #F1F2F3;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  text-decoration: none;
  color: inherit;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

a.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  border-color: var(--accent);
  border-style: solid;
}

.card--soon {
  box-shadow: none;
  border-style: dashed;
  background: transparent;
}

.card-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.card-icon img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.card-tag {
  align-self: flex-start;
  background: var(--chip-bg);
  color: var(--accent-dark);
  border-radius: var(--radius-pill);
  padding: 2px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.card h3 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.card h3 small {
  display: block;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--ink-soft);
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.card-cta {
  margin-top: auto;
  padding-top: 6px;
  font-weight: 700;
  color: var(--accent);
}

.card-cta--soon {
  color: var(--ink-soft);
  opacity: 0.7;
}

#apps .card {
  align-items: center;
  text-align: center;
  gap: 20px;
}

/* Grey hairline at rest; app colour on hover. */
#apps .card {
  border: 1px solid #E5E5E5;
}

#apps a.card:hover {
  border-color: var(--accent);
}

#apps .card h3 {
  margin-top: 18px;
  font-size: 4.5rem;
  font-weight: 700;
}

#apps .card p {
  margin-bottom: 12px;
  line-height: 1.45;
  color: var(--ink);
}

#apps .card h3 small {
  margin-top: 4px;
  color: #000;
  font-size: 1.125rem;
}

#apps a.card h3 small {
  color: var(--accent);
}

#apps .card-tag {
  align-self: center;
  background: var(--chip-bg);
}

#apps .card-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#apps .card-tag-row {
  display: flex;
  gap: 8px;
}

#apps .card-cta:not(.card-cta--soon) {
  color: #000;
}

#apps .card-cta-arrow {
  color: var(--accent);
}

#apps .card p strong {
  font-weight: 700;
}

/* Tools, code and blog: centred text, the apps' outline, and rows centred so a short last
   row sits in the middle (same columns as .card-grid's 280px minimum). */
:is(#tools, #code, #blog) .card {
  align-items: center;
  text-align: center;
  border: 1px solid #E5E5E5;
  background: transparent;
  flex: 0 0 calc((100% - 40px) / 3);
}

:is(#tools, #code, #blog) .card p {
  line-height: 1.35;
  margin-top: 8px;
}

:is(#tools, #code, #blog) a.card:hover {
  border-color: var(--accent);
}

:is(#tools, #code, #blog) .card p {
  color: #000;
}

:is(#tools, #code, #blog) .card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 919.98px) {
  :is(#tools, #code, #blog) .card {
    flex-basis: calc((100% - 20px) / 2);
  }
}

@media (max-width: 619.98px) {
  :is(#tools, #code, #blog) .card {
    flex-basis: 100%;
  }
}

/* Jushi's own colour (style.css --primary). */
.card--jushi {
  --accent: #3D8297;
  --accent-dark: #3D8297;
}

/* TingTing dark-theme primary (tingting/styles.ts). */
.card--tingting {
  --accent: #b8d46b;
  --accent-dark: #b8d46b;
}

/* ---------- contact ---------- */
.contact-row {
  justify-content: center;
  margin-top: 24px;
}

.contact-row .button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-row .button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* ---------- FAQ ---------- */
#faq details {
  background: var(--bg);
  border: 1px dashed #F1F2F3;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 10px;
}

#faq summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

#faq summary::-webkit-details-marker {
  display: none;
}

#faq summary::before {
  content: "+";
  display: inline-block;
  width: 1em;
  color: var(--accent);
  font-weight: 900;
}

#faq details[open] summary::before {
  content: "\2212";
}

#faq details p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

@media (max-width: 520px) {
  header {
    padding-top: calc(var(--nav-height) + 12px);
  }

  section {
    padding: 32px 0;
    min-height: 0;
  }

  .mascot-circle {
    width: 110px;
    height: 110px;
  }

  .mascot-circle--sm {
    width: 88px;
    height: 88px;
  }
}

/* TingTing look (tingting/styles.ts light theme), shared by the hub and the TingTing page. */
:root h1,
:root h2,
:root h3 {
  font-weight: 700;
  color: #000;
}

:root header h1 {
  font-size: clamp(2.25rem, 6.3vw, 3.15rem);
  font-weight: 800;
  margin-bottom: 32px;
}

/* Hub header: headline at the section headline size; grey icon circle. */
:root .hub-header .mascot-circle {
  background: var(--chip-bg);
}

:root .hub-header .mascot-circle img {
  width: 66%;
  height: 66%;
}

/* Pulsating arrow under the hub tagline, linking to the apps. */
.scroll-down {
  display: inline-flex;
  margin-top: 24px;
}

.scroll-down svg {
  width: 32px;
  height: 48px;
}

/* Each chevron pulses in turn, top to bottom. */
.scroll-down path {
  transform-box: fill-box;
  transform-origin: center;
  animation: scroll-down-pulse 2.6s ease-in-out infinite;
}

/* A 1.3s pulse (first half of the cycle), chevrons a third of a pulse apart;
   after the last one fades all three rest for about half a second. */
.scroll-down path:nth-child(2) {
  animation-delay: 0.4333s;
}

.scroll-down path:nth-child(3) {
  animation-delay: 0.8667s;
}

@keyframes scroll-down-pulse {

  0%,
  50%,
  100% {
    transform: scale(1);
    opacity: 0.15;
  }

  25% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-down path {
    animation: none;
  }
}

:root .hub-header h1 {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

:root section h2 {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
}

:root #how-it-works dt {
  color: #b8d46b;
}

:root #drills dt {
  color: var(--accent);
}

:root #how-it-works dd,
:root #drills dd {
  max-width: 52ch;
}

:root h3 {
  font-size: 1.125rem;
}

:root header h1 small {
  font-size: 0.38em;
  font-weight: 700;
  color: inherit;
}

:root .tagline {
  font-size: 0.95rem;
}

:root .tagline strong {
  color: #b8d46b;
}

:root main p,
:root main dd {
  font-size: 0.95rem;
}

:root .tagline,
:root section>.container>p:not(.cta-row),
:root .tingting-preview-copy p,
:root dd,
:root #faq details p {
  color: var(--ink);
}

:root .stat-list li {
  background: var(--chip-bg);
  border-color: var(--border);
  color: var(--accent);
}

/* TingTing's pills are its app's theme.success. */
:root.tingting-page .stat-list li {
  background: #b8d46b;
  border-color: #b8d46b;
  color: var(--ink);
}

/* At most five pills in the upper row. */
:root.tingting-page header .stat-list {
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
}

:root header .stat-list {
  margin-top: 32px;
}

:root main section .mascot-circle {
  background: var(--chip-bg);
}

/* Circles, chips and pills are Jushi's warm grey (--chip-bg) or white:
   white where they sit on a warm-grey section fade (the hub has none: its sections are all white). */
:root:not(.hub-page) main>section:nth-of-type(odd) .mascot-circle {
  background: #FFFFFF;
}

:root .button {
  background: var(--accent);
  color: #F7FAFC;
  border-radius: 28px;
}

/* Tingting's video and screenshot preview. */
.tingting-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 280px) 44px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.tingting-preview-copy h3 {
  margin-bottom: 12px;
  color: var(--accent);
}

#tingting-preview-detail-title {
  color: #b8d46b;
}

/* The first text fades in slowly with the scroll reveal; later texts fade in from site.js. */
.tingting-preview-copy:first-of-type {
  opacity: 0;
  transition: opacity 1.2s ease-in-out 0.3s;
}

.container.is-visible .tingting-preview-copy:first-of-type {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tingting-preview-copy:first-of-type {
    opacity: 1;
    transition: none;
  }
}

.tingting-preview-copy p {
  color: var(--ink-soft);
}

.tingting-preview-phone {
  box-sizing: content-box;
  width: calc(100% - 14px);
  aspect-ratio: 886 / 1920;
  border: 7px solid var(--ink);
  border-radius: 36px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card-hover);
}

.tingting-preview-phone video,
.tingting-preview-phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tingting-preview-phone [hidden] {
  display: none !important;
}

.tingting-preview-controls,
.tingting-preview-dots {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tingting-preview-controls {
  margin-top: 28px;
}

.tingting-preview [data-preview-step] {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 1.75rem;
  cursor: pointer;
}

.tingting-preview-dots button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.tingting-preview-dots button::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-soft);
  opacity: 0.35;
}

.tingting-preview-dots button[aria-current="true"]::after {
  width: 14px;
  background: var(--accent);
  opacity: 1;
}

@media (max-width: 700px) {
  .tingting-preview {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 20px 8px;
    text-align: center;
  }

  .tingting-preview-copy:first-of-type,
  .tingting-preview-copy:last-of-type {
    grid-column: 1 / -1;
  }

  .tingting-preview-phone {
    width: min(250px, calc(100% - 14px));
    justify-self: center;
  }

  .tingting-preview-copy {
    max-width: 42ch;
    justify-self: center;
  }
}

/* Original tone-trainer artwork, including its speech bubble. */
.tone-trainer-splash-circle {
  position: relative;
  width: min(260px, 70vw);
  margin: 0 auto 48px;
  isolation: isolate;
}

.tone-trainer-splash-circle::before {
  content: "";
  position: absolute;
  width: 74%;
  aspect-ratio: 1;
  top: 64%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--chip-bg);
  z-index: -1;
}

.tone-trainer-splash {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- text tools (segmenter.html, pinyin.html, traditional.html, translator.html) ---------- */
.text-tool-input {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 1.25rem;
  color: var(--ink);
  resize: vertical;
}

.text-tool-input:focus {
  outline: none;
  border-color: var(--accent);
}

.text-tool-limits {
  align-self: flex-end;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.text-tool-limits.is-over,
.text-tool-error {
  color: var(--accent);
}

.text-tool-error {
  margin: 0;
}

.text-tool .button,
.translator .button {
  padding: 12px 28px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.text-tool .button:disabled,
.translator .button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Tool pages (translator, segmenter, pinyin, traditional, HSK grader, dictionary,
   decomposition) share a header: at the top rather than centred in the screen, a
   big Chinese headline and a wider description. */
header.tool-header {
  justify-content: flex-start;
  padding-top: calc(var(--nav-height) + clamp(36px, 6vw, 72px));
}

:root header.tool-header h1 {
  font-size: clamp(3rem, 10vw, 4.5rem);
  font-weight: 600;
}

header.tool-header h1 small {
  font-size: 1.4rem;
}

:root header.tool-header .tagline {
  max-width: 70ch;
  font-size: 1.1rem;
}

:root header.tool-header .tagline strong {
  font-weight: 600;
  color: #000;
}

/* Tool panes: the visitor's text and the result side by side on wide screens;
   each pane has a title row and a row of controls. */
.tool-panes {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 20px;
  max-width: 1000px;
  margin: 32px auto 0;
  text-align: left;
}

@media (min-width: 820px) {
  .tool-panes { grid-template-columns: 1fr 1fr; }
}

.tool-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
  background: #fff;
}

.tool-pane:has(.text-tool-input:focus) { border-color: var(--accent); }

.tool-pane--result { background: var(--bg-alt); }

.tool-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.tool-pane-title {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tool-pane .text-tool-input {
  background: transparent;
  flex: 1;
  min-height: 160px;
  padding: 0;
  border: 0;
  border-radius: 0;
  resize: none;
}

.tool-pane .text-tool-limits { align-self: auto; text-align: right; }

/* Pinned to the pane's bottom, so both panes' controls line up. */
.tool-pane-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #E5E5E5;
}

.tool-actions {
  margin-left: auto;
}

.tool-pane .button { padding: 10px 22px; }

.translator .button.translator-explain {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}

.translator-tone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.translator-tone select {
  padding: 8px 12px;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-md);
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.translator-tone select:focus {
  outline: none;
  border-color: var(--accent);
}

.tool-placeholder,
.translator-chinese,
.translator-explanation {
  margin: 0;
}

.tool-placeholder {
  flex: 1;
  color: var(--ink-soft);
}

/* Pane parts set their own display; hidden still hides them. */
.tool-pane [hidden] {
  display: none !important;
}

/* A control row with nothing left to show goes (e.g. once Explain has been used). */
.tool-pane-foot:not(:has(> :not([hidden]))) {
  display: none;
}

.tool-pane-foot .text-tool-export {
  justify-content: flex-start;
  margin: 0;
}

.translator-chinese {
  font-size: 1.75rem;
  line-height: 1.5;
}

.translator-explanation {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid #E5E5E5;
  line-height: 1.6;
}

.translator-explanation-block h3 {
  margin: 0 0 2px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.translator-explanation-block p {
  margin: 0;
  white-space: pre-line;
}

/* Anything else in the panes' grid (Turnstile, shown only if it needs an
   interaction, and errors) spans both panes. */
.tool-panes > :not(.tool-pane) {
  grid-column: 1 / -1;
  justify-self: center;
}

.translator-note {
  max-width: 640px;
  margin: 24px auto 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.text-tool-result {
  max-width: 640px;
  margin: 32px auto 0;
}

/* Inline chips (not flex) so a copied result keeps the spaces between words. */
.text-tool-line {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 2.6;
}

.segment-word {
  display: inline-block;
  padding: 0 12px;
  line-height: 2;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
}

.text-tool-line ruby {
  margin: 0 3px;
  font-size: 1.5rem;
  ruby-position: over;
}

.text-tool-line rt {
  color: var(--accent);
  font-size: 0.5em;
}

/* Words: dictionary translation on hover/tap; with pinyin, the chip makes room for it. */
.segment-word {
  cursor: help;
}

.segment-word:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segment-word--pinyin {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  line-height: 1.3;
  vertical-align: bottom;
  border-radius: var(--radius-md);
}

.segment-reading {
  color: var(--accent);
  font-size: 0.6em;
}

.text-tool-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.text-tool-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.text-tool-export {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 16px;
  margin-top: 8px;
}

.text-tool-export .button {
  padding: 10px 20px;
  border: 1px solid #E5E5E5;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.text-tool-export .button:hover {
  border-color: var(--accent);
}

.text-tool-tooltip {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
  pointer-events: none;
}

.text-tool-tooltip[hidden] {
  display: none;
}

.text-tool-export .button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Slightly larger item headings in Tingting's two feature sections. */
.tingting-page :is(#how-it-works, #drills) dt {
  font-size: 1.15em;
}

/* Tingting's hero: black app name in the tagline. */
.tingting-page .tagline strong {
  color: #000;
}

/* Blog posts: body text left-aligned at a readable width. */
.blog-post p {
  max-width: 66ch;
  margin: 0 auto 24px;
  text-align: left;
  color: var(--ink);
}

/* Blog date and tag pills (index cards and the post header). */
.post-date {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

#blog .post-tags {
  margin: 12px 0 0;
}

/* credits.html: one source per line. */
.credits-list {
  max-width: 66ch;
  margin: 0 auto;
  padding-left: 20px;
  text-align: left;
  line-height: 1.6;
}

.credits-list li {
  margin-bottom: 12px;
}

.post-subheading {
  margin: 40px 0 16px;
}

/* DouDou icon sitting right above the word "DouDou"; only that line grows. */
.post-mascot {
  white-space: nowrap;
}

.post-mascot img {
  display: inline-block;
  width: 18px;
  height: auto;
  margin-left: 4px;
  vertical-align: -2px;
}

/* Underlined term with a pop-up on hover (or tap, via focus). */
.term {
  position: relative;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: help;
}

.term-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(calc(-50% + var(--tip-shift, 0px)));
  z-index: 10;
  width: max-content;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #FFFFFF;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.term-tip strong {
  display: block;
}

.term:hover .term-tip,
.term:focus .term-tip {
  opacity: 1;
  visibility: visible;
}

.post-image {
  display: block;
  width: 100%;
  max-width: 66ch;
  height: auto;
  margin: 8px auto 24px;
}

.download-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.download-table {
  width: 100%;
  border-collapse: collapse;
  margin: 40px 0;
}

.download-table th,
.download-table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid #e6e6e6;
}

.download-table th {
  font-weight: 600;
}

.download-table a {
  display: inline-block;
  padding: 4px;
}

.download-note {
  font-size: .9em;
}

/* Downloads: centred headings and text, more room between blocks. */
#downloads h3 {
  margin: 72px 0 16px;
  text-align: center;
}

#downloads p {
  margin: 0 auto 24px;
  text-align: center;
}

.download-table caption {
  padding-bottom: 16px;
  font-size: 1.125rem;
  font-weight: 700;
}
/* Downloads: each group is a collapsible card. */
.download-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 0 24px;
  margin-top: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.download-group:first-of-type {
  margin-top: 48px;
}

.download-group:hover,
.download-group[open] {
  border-color: var(--accent);
}

.download-group[open] {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.download-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -24px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-lg);
}

.download-group summary::-webkit-details-marker {
  display: none;
}

.download-group summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#downloads .download-group h3 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 1.125rem;
}

/* Spacer matching the chevron's width so the title stays centred. */
.download-group summary::before {
  content: '';
  flex: none;
  width: 9px;
}

/* Chevron: points down when closed, up when open. */
.download-group summary::after {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.2s ease, margin 0.2s ease;
}

.download-group[open] summary::after {
  margin-top: 5px;
  transform: rotate(-135deg);
}

.download-group[open] summary {
  margin-bottom: 8px;
}

#downloads .download-group > :last-child {
  margin-bottom: 24px;
}

.download-group .download-table {
  margin: 24px 0;
}

.download-group .download-table th {
  white-space: nowrap;
}

@media (max-width: 619.98px) {
  .download-group {
    padding: 0 16px;
  }

  .download-group summary {
    margin: 0 -16px;
    padding: 18px 16px;
  }
}

/* Keep Phrase Loop's icon and subtitle close together. */
:root.phraseloop-page .tone-trainer-splash-circle {
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--chip-bg);
  overflow: hidden;
}

:root.phraseloop-page .tone-trainer-splash-circle::before {
  content: none;
}

:root.phraseloop-page header h1 {
  color: var(--accent);
  margin-top: 20px;
  font-size: 1.5rem;
  font-weight: 700;
}


:root.phraseloop-page .stat-list li {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* Phrase Loop section subheadlines use red. */
:root.phraseloop-page #how-it-works dt,
:root.phraseloop-page #sentences dt {
  color: var(--accent);
}

:root.phraseloop-page .tagline strong {
  color: #000000;
}

/* The site footer, the same on every page (imported by site.js, script.js
   and footer.js for the imprint): a back-to-top button, then a grey bar
   with copyright left and legal links right, then a pattern band. Colours
   are literal so it does not depend on the page's own stylesheet. */
/* Pages shorter than the screen: the footer sits at its bottom. */
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-snap-align: end;
  scroll-snap-stop: always;
  font-family: "Nunito", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  text-align: center;
}
.footer-bottom {
  align-self: stretch;
  min-height: 40px;
  /* Full-width grey, content at most 1000px wide. */
  padding: 0 max(20px, calc((100% - 1000px) / 2));
  background: #F4F3F2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}
.footer-bottom p { margin: 0; color: #000; }
.footer-legal { display: flex; gap: 2rem; }
.footer-legal a { color: #1A2A44; text-decoration: none; }
.footer-legal a:hover { color: var(--accent, #ca3825); text-decoration: none; }
#back-to-top {
  /* Above the grey bar, though it comes after it in the markup. */
  order: -1;
  margin: 20px 0 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: #ca3825;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
#back-to-top:hover {
  background: #A82E1F;
  transform: translateY(-2px);
}
/* A full-width band of the red pattern along the footer's bottom edge,
   repeated across (tile.png repeats seamlessly). */
footer::after {
  content: "";
  align-self: stretch;
  height: 96px;
  background: url(images/tile.97821e1fd65466bfdd69518c6f8c3ca8.png) center top / auto 192px repeat-x;
}
@media (max-width: 968px) {
  .footer-bottom { flex-direction: column; text-align: center; padding-block: 16px; }
}
@media (max-width: 640px) {
  .footer-legal { flex-direction: column; gap: 1rem; }
}


/*# sourceMappingURL=site.css.map*/