:root {
  --bg: #f7f3e8;
  --bg-deep: #efe8d7;
  --surface: #fffdf8;
  --surface-soft: #fbf7ed;
  --ink: #26382f;
  --ink-soft: #46584e;
  --muted: #76837a;
  --muted-light: #93a097;
  --line: #e5dece;
  --line-strong: #d8ceb9;
  --green: #54b486;
  --green-dark: #2e7e5b;
  --green-pale: #e4f6ec;
  --yellow: #f4bd3f;
  --yellow-deep: #c59016;
  --yellow-pale: #fff4d1;
  --peach: #ef9b7d;
  --peach-pale: #ffede5;
  --violet: #8976d2;
  --violet-pale: #f0ecff;
  --blue: #5b95bc;
  --blue-pale: #eaf5fb;
  --pink: #d77b98;
  --pink-pale: #ffeff4;
  --shadow-sm: 0 2px 0 rgba(77, 65, 41, 0.08), 0 6px 18px rgba(77, 65, 41, 0.06);
  --shadow-md: 0 7px 0 rgba(77, 65, 41, 0.07), 0 18px 42px rgba(77, 65, 41, 0.09);
  --shadow-lg: 0 24px 80px rgba(54, 47, 33, 0.16);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-ui: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-display: "Trebuchet MS", "Avenir Next", "Segoe UI", "Microsoft YaHei",
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

::selection {
  color: #1d3226;
  background: #ffe49a;
}

:focus-visible {
  outline: 3px solid #3f936d;
  outline-offset: 3px;
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 500;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.background-blobs {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.66;
}

.blob-mint {
  top: -120px;
  right: -90px;
  width: 470px;
  height: 470px;
  background: radial-gradient(circle at 35% 35%, #dcf7e7, rgba(220, 247, 231, 0));
}

.blob-peach {
  top: 420px;
  left: -190px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle at 55% 45%, #ffe4d7, rgba(255, 228, 215, 0));
}

.blob-lemon {
  right: 5%;
  bottom: -230px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle at 50% 50%, #fff0bd, rgba(255, 240, 189, 0));
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 243, 232, 0.86);
  border-bottom: 1px solid rgba(214, 204, 183, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, 100%);
  height: 76px;
  margin: 0 auto;
  padding: 0 28px;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  border-radius: 14px;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  background: var(--green);
  border: 1.5px solid #3b976d;
  border-radius: 14px;
  box-shadow: 0 4px 0 #3d8f69, 0 8px 17px rgba(47, 128, 90, 0.19);
}

.brand-mark svg {
  width: 42px;
  height: 42px;
}

.brand-card.back {
  fill: #bde8d1;
  opacity: 0.78;
}

.brand-card.front {
  fill: #fffdf7;
  stroke: #2e7655;
  stroke-width: 1.4;
}

.brand-star {
  fill: var(--yellow);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.top-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.tool-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.8);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 2px 0 rgba(91, 78, 52, 0.05);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.tool-button:hover {
  background: #fffdf8;
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.tool-button:active {
  transform: translateY(1px);
}

.tool-label {
  font-size: 0.82rem;
  font-weight: 800;
}

.sound-icon {
  width: 19px;
  height: 19px;
  fill: var(--green-dark);
  stroke: var(--green-dark);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-icon path:first-child {
  stroke: none;
}

.sound-icon-off {
  display: none;
}

.sound-toggle.is-muted .sound-icon-on {
  display: none;
}

.sound-toggle.is-muted .sound-icon-off {
  display: block;
  fill: var(--muted);
  stroke: var(--muted);
}

.sound-toggle.is-muted {
  color: var(--muted);
}

.stars-button {
  position: relative;
  padding-right: 7px;
  color: #6e4e09;
  background: #fff7d9;
  border-color: #eed684;
}

.stars-button:hover {
  background: #fff2bd;
  border-color: #e4c45e;
}

.star-icon {
  width: 19px;
  height: 19px;
  fill: var(--yellow);
  stroke: #c99b23;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.stars-count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  place-items: center;
  color: #fffdf7;
  background: var(--ink);
  border-radius: 999px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  transition: transform 220ms cubic-bezier(0.22, 1.3, 0.36, 1);
}

.stars-count.is-bumping {
  transform: scale(1.32) rotate(-5deg);
}

.topbar-progress {
  height: 3px;
  background: rgba(198, 186, 163, 0.22);
}

.topbar-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #63bf91, #b7dc53, #f4bd3f);
  border-radius: 0 99px 99px 0;
  transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- hero ---------- */

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.68fr);
  gap: 34px;
  align-items: center;
  padding: 62px 10px 48px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  animation: rise-in 620ms 80ms both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.eyebrow {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 18px;
  padding: 7px 12px;
  color: var(--green-dark);
  background: rgba(228, 246, 236, 0.86);
  border: 1px solid #c6e9d6;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(84, 180, 134, 0.16);
}

.hero h1 {
  max-width: 740px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 5.5vw, 4.7rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1.01;
}

.hero h1 .highlight {
  position: relative;
  display: inline;
  color: var(--green-dark);
  background-image: linear-gradient(transparent 67%, rgba(244, 189, 63, 0.52) 67%, rgba(244, 189, 63, 0.52) 94%, transparent 94%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero-lead {
  max-width: 610px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.8;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 25px;
}

.hero-tag {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 11px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.hero-tag > span {
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 900;
}

.hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 310px;
  animation: rise-in 700ms 180ms both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.demo-stack {
  position: relative;
  width: 300px;
  height: 246px;
}

.demo-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 228px;
  min-height: 101px;
  padding: 17px 20px;
  border: 1.5px solid #d9cbaa;
  border-radius: 19px;
  box-shadow: 0 8px 0 rgba(91, 77, 48, 0.07), 0 20px 38px rgba(80, 65, 37, 0.13);
}

.demo-card-back {
  top: 0;
  right: 2px;
  background: var(--violet-pale);
  border-color: #d7cdf9;
  transform: rotate(7deg);
  animation: card-float-a 7s ease-in-out infinite;
}

.demo-card-mid {
  top: 70px;
  left: 0;
  background: var(--surface);
  transform: rotate(-7deg);
  animation: card-float-b 8s 0.4s ease-in-out infinite;
}

.demo-card-front {
  right: 15px;
  bottom: 0;
  background: var(--yellow-pale);
  border-color: #e9cf7b;
  transform: rotate(1.5deg);
  animation: card-float-c 7.5s 0.2s ease-in-out infinite;
}

.demo-word {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.demo-type {
  margin-bottom: 5px;
  color: #5e4a9a;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.demo-card-back strong {
  color: #4e3c8a;
  font-size: 1.1rem;
  font-weight: 900;
}

.demo-star {
  position: absolute;
  top: 11px;
  right: 14px;
  color: var(--yellow);
  font-size: 1.45rem;
  text-shadow: 0 1px 0 #b88617;
  transform: rotate(12deg);
}

.demo-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
}

.demo-pill {
  align-self: flex-start;
  margin-top: 9px;
  padding: 2px 8px;
  color: #79570d;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.art-sparkle {
  position: absolute;
  color: var(--yellow);
  font-size: 1.45rem;
  line-height: 1;
  animation: twinkle 3.5s ease-in-out infinite;
}

.sparkle-one {
  top: 26px;
  left: 23px;
  transform: rotate(-13deg);
}

.sparkle-two {
  right: 5px;
  bottom: 43px;
  color: var(--peach);
  font-size: 1.05rem;
  animation-delay: 1.2s;
}

.art-dot {
  position: absolute;
  border-radius: 50%;
}

.dot-one {
  top: 45px;
  right: 25px;
  width: 13px;
  height: 13px;
  background: var(--green);
  opacity: 0.55;
}

.dot-two {
  bottom: 28px;
  left: 18px;
  width: 9px;
  height: 9px;
  background: var(--violet);
  opacity: 0.5;
}

.art-caption {
  position: absolute;
  right: 1px;
  bottom: 6px;
  padding: 5px 9px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  transform: rotate(-3deg);
}

/* ---------- reader ---------- */

.reader {
  position: relative;
  padding: 34px;
  background: var(--surface);
  border: 1.5px solid #e9e1d1;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  animation: rise-in 720ms 160ms both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reader::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 140px;
  height: 5px;
  background: #f7d982;
  border-radius: 0 0 99px 99px;
  content: "";
  transform: translateX(-50%);
}

.reader-head {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 7px 4px 25px;
  border-bottom: 1px dashed #e6dfd0;
}

.article-title {
  min-width: 0;
}

.article-kicker {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--green-dark);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.article-kicker svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.article-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.article-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.article-subtitle > span:first-child {
  color: #5b6c61;
}

.dot-separator {
  color: #b9b2a3;
}

.progress-card {
  flex: 0 0 252px;
  padding: 12px 15px 11px;
  background: #f5faf6;
  border: 1px solid #dceee2;
  border-radius: 15px;
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #587164;
  font-size: 0.68rem;
  font-weight: 800;
}

.progress-topline strong {
  color: var(--green-dark);
  font-size: 0.92rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: #dfeae2;
  border-radius: 999px;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #52b583, #8dcc74);
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-card p span {
  color: var(--ink-soft);
  font-weight: 900;
}

.progress-card.is-complete {
  background: #fff9df;
  border-color: #f0d989;
}

.progress-card.is-complete .progress-track > span {
  background: linear-gradient(90deg, #f0b736, #f7d66b);
}

.progress-card.is-complete .progress-topline strong {
  color: #8a6109;
}

.reader-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 4px 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.guide-tip,
.guide-legend {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.tip-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 900;
}

.legend-chip {
  width: 23px;
  height: 12px;
  background: var(--yellow-pale);
  border: 1px solid #e7cf86;
  border-radius: 5px;
  box-shadow: 0 1.5px 0 #d8bd6f;
}

.article-paper {
  position: relative;
  padding: 24px 26px 22px;
  background:
    radial-gradient(circle at 11px 11px, rgba(218, 207, 185, 0.26) 1px, transparent 1.2px) 0 0 / 23px 23px,
    linear-gradient(180deg, #fffefa, #fffcf6);
  border: 1px solid #eee7d8;
  border-radius: var(--radius-lg);
}

.article {
  min-height: 138px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 78px;
  white-space: pre-wrap;
  overflow-wrap: normal;
}

.article.is-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.article-error {
  max-width: 540px;
  margin: 30px auto;
  padding: 20px;
  color: #7c3b2f;
  background: #fff0ea;
  border: 1px dashed #e5a995;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: left;
  white-space: normal;
}

.article-space {
  white-space: pre;
}

.article-punct {
  display: inline-block;
  color: #64746a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}

/* The unit keeps a card and the star hit area together in the text flow. */
.card-token {
  --tone: #7d9185;
  --tone-ink: #3d5548;
  --tone-bg: #f3f6f2;
  --tone-edge: #dce5dd;
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  vertical-align: middle;
}

.card-token.tone-green {
  --tone: #56a77b;
  --tone-ink: #275e43;
  --tone-bg: #e9f7ef;
  --tone-edge: #c9e8d7;
}

.card-token.tone-coral {
  --tone: #df8367;
  --tone-ink: #86412f;
  --tone-bg: #fff0e9;
  --tone-edge: #f7d4c8;
}

.card-token.tone-violet {
  --tone: #8b78d3;
  --tone-ink: #4f3d8c;
  --tone-bg: #f1edff;
  --tone-edge: #dcd3fa;
}

.card-token.tone-gold {
  --tone: #d3a02a;
  --tone-ink: #73520d;
  --tone-bg: #fff6d8;
  --tone-edge: #f2dda0;
}

.card-token.tone-blue {
  --tone: #5f99bd;
  --tone-ink: #2e607e;
  --tone-bg: #eaf5fb;
  --tone-edge: #cfe8f5;
}

.card-token.tone-pink {
  --tone: #d8839e;
  --tone-ink: #7b3b50;
  --tone-bg: #fff0f5;
  --tone-edge: #f5d2dd;
}

.card-token.tone-slate {
  --tone: #89978f;
  --tone-ink: #46564c;
  --tone-bg: #f1f4f1;
  --tone-edge: #dce4dd;
}

.card-perspective {
  position: relative;
  display: inline-block;
  perspective: 950px;
}

.word-card {
  position: relative;
  display: block;
  width: max-content;
  min-width: 64px;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fffefa;
  border: 1.5px solid #ddd4c1;
  border-radius: 14px;
  box-shadow:
    inset 0 -3px 0 var(--tone-edge),
    0 4px 0 rgba(101, 87, 57, 0.08),
    0 8px 18px rgba(67, 57, 36, 0.06);
  transform: translateY(0);
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease,
    border-color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.card-token.is-phrase .word-card {
  background: linear-gradient(180deg, #fffefb 0%, #fff9e8 100%);
  border-color: #e3d2aa;
  border-radius: 15px;
}

.card-token:hover .word-card {
  z-index: 1;
  border-color: #cfc3aa;
  box-shadow:
    inset 0 -3px 0 var(--tone-edge),
    0 6px 0 rgba(101, 87, 57, 0.09),
    0 14px 25px rgba(67, 57, 36, 0.1);
  transform: translateY(-2px) rotate(-0.25deg);
}

.card-token.is-flipped .word-card {
  border-color: var(--tone);
  box-shadow:
    inset 0 -3px 0 var(--tone-edge),
    0 5px 0 color-mix(in srgb, var(--tone) 36%, transparent),
    0 12px 22px rgba(67, 57, 36, 0.09);
  transform: translateY(0);
}

.card-token.is-flipped:hover .word-card {
  transform: translateY(-1px);
}

.card-inner {
  position: relative;
  display: block;
  min-height: 58px;
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(0.25, 0.9, 0.25, 1);
}

.card-token.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  min-height: 58px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card-front {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px 10px;
  background: transparent;
}

.card-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  background: var(--tone-bg);
  border-radius: 12px;
  transform: rotateY(180deg);
}

.front-word {
  font-family: var(--font-display);
  font-size: 0.99rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.14;
  white-space: nowrap;
}

.card-token.is-phrase .front-word {
  font-size: 0.94rem;
  letter-spacing: -0.025em;
}

.back-meaning {
  display: -webkit-box;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--tone-ink);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.star-button {
  position: absolute;
  top: -9px;
  right: -10px;
  z-index: 4;
  display: grid;
  width: 29px;
  height: 29px;
  padding: 0;
  place-items: center;
  color: #c28f15;
  background: #fff9e3;
  border: 1.5px solid #e5c260;
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(136, 101, 25, 0.2), 0 5px 12px rgba(75, 58, 21, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.3) rotate(-18deg);
  transition:
    opacity 150ms ease,
    transform 260ms cubic-bezier(0.2, 1.4, 0.4, 1),
    background 160ms ease;
}

.star-button svg {
  width: 16px;
  height: 16px;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.card-token.is-flipped .star-button {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) rotate(0);
}

.star-button:hover {
  background: #fff2b9;
  transform: scale(1.12) rotate(8deg);
}

.card-token.is-faved .star-button {
  color: #fffdf8;
  background: var(--yellow);
  border-color: #c99517;
  box-shadow: 0 3px 0 #b88719, 0 6px 14px rgba(121, 88, 12, 0.22);
}

.card-token.is-faved .star-button svg {
  fill: currentColor;
}

.card-token.is-faved .star-button:hover {
  transform: scale(1.12) rotate(-8deg);
}

.star-button.is-celebrating {
  animation: star-pop 480ms cubic-bezier(0.2, 1.5, 0.45, 1);
}

.fav-pin {
  position: absolute;
  bottom: -7px;
  left: 9px;
  z-index: 3;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #fffdf8;
  background: var(--yellow);
  border: 1px solid #c99a22;
  border-radius: 50%;
  box-shadow: 0 2px 0 rgba(121, 88, 12, 0.18);
  font-size: 0.58rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
  transition:
    opacity 160ms ease,
    transform 240ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.card-token.is-faved .fav-pin {
  opacity: 1;
  transform: scale(1);
}

.card-token.is-faved.is-flipped .fav-pin {
  opacity: 0;
  transform: scale(0);
}

/* ---------- context ---------- */

.context-panel {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-top: 17px;
  padding: 14px 17px;
  background: #f4faf6;
  border: 1px solid #dcece2;
  border-radius: 15px;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.context-panel.is-active {
  background: #f2f8ff;
  border-color: #d3e7f4;
}

.context-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  place-items: center;
  color: var(--green-dark);
  background: #e3f4ea;
  border-radius: 10px;
}

.context-panel.is-active .context-icon {
  color: #336e90;
  background: #e3f2fb;
}

.context-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-copy {
  min-width: 0;
}

.context-title {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.context-text {
  margin: 0;
  color: #5e7065;
  font-size: 0.78rem;
  line-height: 1.6;
}

.context-word-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 3px;
}

.context-word {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.context-type {
  padding: 1px 7px;
  color: #336e90;
  background: #e3f2fb;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 900;
}

.context-meaning {
  color: #2f7252;
  font-size: 0.85rem;
  font-weight: 900;
}

.context-note {
  margin: 5px 0 0;
  color: #52675b;
  font-size: 0.78rem;
  line-height: 1.62;
}

.context-sentence {
  margin: 8px 0 0;
  padding: 7px 11px;
  color: #455b4e;
  background: rgba(255, 255, 255, 0.72);
  border-left: 3px solid #9acdb1;
  border-radius: 0 8px 8px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* ---------- reader footer ---------- */

.reader-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 19px 4px 1px;
}

.reset-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 37px;
  padding: 6px 13px;
  color: var(--ink-soft);
  background: #fffdf8;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(101, 87, 57, 0.05);
  font-size: 0.72rem;
  font-weight: 800;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.reset-button:hover:not(:disabled) {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.reset-button:disabled {
  color: #adb5ae;
  background: #f7f5ee;
  cursor: not-allowed;
  opacity: 0.74;
}

.reset-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foot-note {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted-light);
  font-size: 0.67rem;
  font-weight: 700;
}

.local-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
}

/* ---------- feature strip ---------- */

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 22px 0 55px;
}

.feature-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 18px;
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid rgba(224, 214, 194, 0.82);
  border-radius: 17px;
}

.feature-number {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 900;
}

.feature-card h3 {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.4;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.65;
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 28px 28px;
  color: #98a199;
  font-size: 0.65rem;
  font-weight: 700;
}

/* ---------- favorites drawer ---------- */

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(30, 42, 35, 0.4);
  opacity: 0;
  transition: opacity 260ms ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drawer-scrim.is-visible {
  opacity: 1;
}

.favorites-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(432px, 94vw);
  background: #fbf8ef;
  border-left: 1px solid #e5dccb;
  box-shadow: -18px 0 65px rgba(35, 42, 34, 0.18);
  transform: translateX(105%);
  visibility: hidden;
  transition:
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s 340ms;
}

.favorites-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition:
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}

.drawer-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 27px 25px 19px;
  border-bottom: 1px solid #ebe3d3;
}

.drawer-kicker {
  color: var(--yellow-deep);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.drawer-head h2 {
  margin: 2px 0 3px;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.drawer-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.close-button {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: #fffdf8;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.close-button:hover {
  background: #f6f1e5;
  transform: rotate(4deg);
}

.close-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.drawer-body {
  flex: 1;
  padding: 19px 20px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d6ccba transparent;
  scrollbar-width: thin;
}

.drawer-body::-webkit-scrollbar {
  width: 8px;
}

.drawer-body::-webkit-scrollbar-thumb {
  background: #d6ccba;
  border: 2px solid #fbf8ef;
  border-radius: 999px;
}

.fav-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 30px 20px;
  text-align: center;
}

.fav-empty-art {
  position: relative;
  display: grid;
  width: 108px;
  height: 108px;
  margin-bottom: 21px;
  place-items: center;
  color: var(--yellow);
  background: #fff5cf;
  border: 1.5px dashed #e4c45d;
  border-radius: 34px;
  font-size: 2.6rem;
  transform: rotate(-4deg);
}

.fav-empty-art::after {
  position: absolute;
  right: -10px;
  bottom: -9px;
  color: var(--green);
  font-size: 1.1rem;
  content: "✦";
  transform: rotate(12deg);
}

.fav-empty h3 {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 900;
}

.fav-empty p {
  max-width: 270px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.fav-empty button {
  margin-top: 18px;
  padding: 9px 16px;
  color: #fffdf8;
  background: var(--green-dark);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 3px 0 #236345;
  font-size: 0.75rem;
  font-weight: 900;
}

.fav-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fav-card {
  position: relative;
  perspective: 1100px;
  animation: rise-in 300ms both ease-out;
}

.fav-flipper {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 18px;
}

.fav-inner {
  display: grid;
  min-height: 210px;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.25, 0.9, 0.25, 1);
}

.fav-flipper[aria-expanded="true"] .fav-inner {
  transform: rotateY(180deg);
}

.fav-face {
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  padding: 19px 20px;
  overflow: hidden;
  border: 1.5px solid #e0d6c2;
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(87, 73, 45, 0.08), 0 16px 28px rgba(72, 59, 35, 0.07);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.fav-front {
  justify-content: space-between;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.8), transparent 38%),
    linear-gradient(145deg, #f0faf4, #e5f5ec);
  border-color: #cfe7d9;
}

.fav-saved {
  align-self: flex-start;
  padding: 3px 8px;
  color: #7b5b0d;
  background: #fff2bd;
  border-radius: 999px;
  font-size: 0.59rem;
  font-weight: 900;
}

.fav-word {
  display: block;
  margin: 22px 0 6px;
  color: #285c43;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.5vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.fav-front-type {
  color: #5f7d6c;
  font-size: 0.66rem;
  font-weight: 800;
}

.fav-front-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  color: #6b8173;
  font-size: 0.65rem;
  font-weight: 700;
}

.fav-front-hint span:last-child {
  font-size: 0.9rem;
}

.fav-back {
  justify-content: flex-start;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.9), transparent 40%),
    #fffdf8;
  transform: rotateY(180deg);
}

.fav-back-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 700;
}

.fav-type-pill {
  padding: 2px 7px;
  color: #8a6109;
  background: #fff2bd;
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 900;
}

.fav-meaning {
  display: block;
  margin: 13px 0 8px;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.fav-note {
  margin: 0;
  color: #5b6e62;
  font-size: 0.73rem;
  line-height: 1.62;
}

.fav-sentence {
  margin: 12px 0 0;
  padding: 8px 10px;
  color: #42564a;
  background: #f5f9f5;
  border-left: 3px solid #9ccfb3;
  border-radius: 0 8px 8px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  line-height: 1.5;
}

.fav-source {
  margin: auto 0 0;
  padding-top: 10px;
  color: #98a198;
  font-size: 0.59rem;
  font-weight: 700;
}

.fav-delete {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 5;
  display: grid;
  width: 33px;
  height: 33px;
  padding: 0;
  place-items: center;
  color: #9f796e;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid #eadfd2;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  transition:
    color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.fav-delete:hover {
  color: #a33e2c;
  background: #fff0eb;
  transform: translateY(-1px);
}

.fav-delete svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-foot {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 15px 20px calc(15px + env(safe-area-inset-bottom));
  color: #98a198;
  border-top: 1px solid #ebe3d3;
  font-size: 0.62rem;
  font-weight: 700;
}

/* ---------- toast and effects ---------- */

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  z-index: 240;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  color: #fffdf7;
  background: #25372e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(28, 39, 32, 0.25);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fly-layer,
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 230;
  overflow: hidden;
  pointer-events: none;
}

.confetti-layer {
  z-index: 220;
}

.fly-star {
  position: fixed;
  z-index: 1;
  color: var(--yellow);
  font-size: 1rem;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(150, 104, 8, 0.22);
  animation: fly-star 700ms cubic-bezier(0.22, 0.7, 0.3, 1) both;
}

.confetti {
  position: absolute;
  top: -24px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall var(--fall-time, 2.2s) cubic-bezier(0.18, 0.6, 0.4, 1) forwards;
}

/* ---------- animations ---------- */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-float-a {
  0%,
  100% {
    transform: rotate(7deg) translateY(0);
  }
  50% {
    transform: rotate(5.5deg) translateY(-7px);
  }
}

@keyframes card-float-b {
  0%,
  100% {
    transform: rotate(-7deg) translateY(0);
  }
  50% {
    transform: rotate(-5.4deg) translateY(5px);
  }
}

@keyframes card-float-c {
  0%,
  100% {
    transform: rotate(1.5deg) translateY(0);
  }
  50% {
    transform: rotate(0deg) translateY(-5px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.48;
    transform: scale(0.85) rotate(-8deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(4deg);
  }
}

@keyframes star-pop {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.42) rotate(14deg);
  }
  68% {
    transform: scale(0.9) rotate(-5deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fly-star {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  72% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(var(--fly-x), var(--fly-y)) scale(0.3) rotate(180deg);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    opacity: 0.1;
    transform: translate3d(var(--drift, 0), 105vh, 0) rotate(var(--spin, 540deg));
  }
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(270px, 0.8fr);
    gap: 16px;
    padding-top: 50px;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 5.3vw, 3.95rem);
  }

  .demo-stack {
    width: 270px;
    transform: scale(0.9);
  }

  .article {
    line-height: 74px;
  }

  .feature-card {
    padding: 15px;
  }
}

@media (max-width: 800px) {
  .topbar-inner {
    padding: 0 20px;
  }

  main {
    padding: 0 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 43px 4px 34px;
  }

  .hero-art {
    display: none;
  }

  .hero-lead {
    max-width: 690px;
  }

  .reader {
    padding: 25px;
    border-radius: 26px;
  }

  .reader-head {
    flex-direction: column;
    gap: 17px;
  }

  .progress-card {
    width: 100%;
    flex-basis: auto;
  }

  .feature-strip {
    grid-template-columns: 1fr;
    padding-bottom: 38px;
  }

  .feature-card {
    align-items: center;
  }

  .page-footer {
    padding: 0 20px 24px;
  }

  .article {
    line-height: 69px;
  }
}

@media (max-width: 620px) {
  .topbar-inner {
    height: 66px;
    padding: 0 14px;
  }

  .brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 12px;
  }

  .brand-mark svg {
    width: 37px;
    height: 37px;
  }

  .brand-copy strong {
    font-size: 1.12rem;
  }

  .brand-copy small {
    font-size: 0.5rem;
  }

  .top-actions {
    gap: 6px;
  }

  .tool-button {
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 11px;
  }

  .tool-label {
    display: none;
  }

  .sound-toggle {
    width: 38px;
    justify-content: center;
    padding: 0;
  }

  .stars-button {
    width: auto;
    padding: 5px 6px 5px 9px;
    gap: 5px;
  }

  .star-icon {
    width: 18px;
    height: 18px;
  }

  .stars-count {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.67rem;
  }

  main {
    padding: 0 13px;
  }

  .hero {
    padding: 34px 2px 28px;
  }

  .eyebrow {
    margin-bottom: 14px;
    font-size: 0.64rem;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 11vw, 3.1rem);
    line-height: 1.04;
  }

  .hero-lead {
    margin-top: 17px;
    font-size: 0.92rem;
    line-height: 1.75;
  }

  .hero-tags {
    gap: 6px;
    margin-top: 18px;
  }

  .hero-tag {
    padding: 5px 8px;
    font-size: 0.66rem;
  }

  .reader {
    padding: 18px 14px;
    border-radius: 22px;
  }

  .reader::before {
    width: 100px;
    height: 4px;
  }

  .reader-head {
    padding: 7px 2px 18px;
  }

  .article-title h2 {
    font-size: 1.66rem;
  }

  .article-subtitle {
    margin-top: 6px;
    font-size: 0.7rem;
  }

  .progress-card {
    padding: 10px 12px;
  }

  .reader-guide {
    padding: 14px 2px 7px;
    font-size: 0.66rem;
  }

  .guide-legend {
    display: none;
  }

  .article-paper {
    padding: 16px 11px 12px;
    border-radius: 17px;
    background:
      radial-gradient(circle at 9px 9px, rgba(218, 207, 185, 0.2) 1px, transparent 1.2px) 0 0 / 18px 18px,
      linear-gradient(180deg, #fffefa, #fffcf6);
  }

  .article {
    min-height: 100px;
    line-height: 65px;
  }

  .card-token {
    margin: 0 1px;
  }

  .word-card {
    min-width: 58px;
    min-height: 53px;
    border-radius: 12px;
  }

  .card-inner,
  .card-face {
    min-height: 53px;
  }

  .card-front {
    padding: 6px 10px 8px;
  }

  .front-word {
    font-size: 0.9rem;
  }

  .card-token.is-phrase .front-word {
    font-size: 0.85rem;
  }

  .card-back {
    padding: 4px 5px;
    border-radius: 10px;
  }

  .back-meaning {
    font-size: 0.7rem;
    -webkit-line-clamp: 3;
  }

  .article-punct {
    font-size: 1.26rem;
  }

  .star-button {
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
  }

  .star-button svg {
    width: 14px;
    height: 14px;
  }

  .fav-pin {
    bottom: -6px;
    left: 7px;
    width: 16px;
    height: 16px;
    font-size: 0.51rem;
  }

  .context-panel {
    margin-top: 13px;
    padding: 12px;
  }

  .context-icon {
    width: 30px;
    height: 30px;
  }

  .context-icon svg {
    width: 17px;
    height: 17px;
  }

  .context-text,
  .context-note {
    font-size: 0.74rem;
  }

  .context-word {
    font-size: 0.92rem;
  }

  .context-sentence {
    font-size: 0.72rem;
  }

  .reader-foot {
    padding-top: 15px;
  }

  .foot-note {
    font-size: 0.61rem;
  }

  .feature-strip {
    padding-top: 15px;
  }

  .feature-card {
    padding: 13px;
  }

  .page-footer {
    padding: 0 14px 20px;
    font-size: 0.59rem;
  }

  .favorites-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 90dvh;
    border-top: 1px solid #e5dccb;
    border-left: 0;
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -18px 60px rgba(35, 42, 34, 0.18);
    transform: translateY(105%);
  }

  .favorites-drawer.is-open {
    transform: translateY(0);
  }

  .drawer-head {
    padding: 21px 18px 15px;
  }

  .drawer-head h2 {
    font-size: 1.45rem;
  }

  .drawer-body {
    padding: 15px 14px 22px;
  }

  .fav-inner {
    min-height: 204px;
  }

  .fav-face {
    padding: 16px;
  }

  .fav-word {
    margin-top: 18px;
  }

  .drawer-foot {
    font-size: 0.58rem;
  }

  .toast {
    bottom: calc(19px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .hero h1 {
    font-size: 2.35rem;
  }

  .reader {
    padding: 16px 11px;
  }

  .article {
    line-height: 62px;
  }

  .word-card {
    min-width: 58px;
    min-height: 51px;
  }

  .card-inner,
  .card-face {
    min-height: 51px;
  }

  .front-word {
    font-size: 0.86rem;
  }

  .card-token.is-phrase .front-word {
    font-size: 0.82rem;
  }

  .back-meaning {
    font-size: 0.66rem;
  }

  .reader-guide {
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   第二阶段：输入页、AI 状态、阅读页切换与拖拽摘星
   ========================================================= */

[hidden] {
  display: none !important;
}

.input-view,
.reader-view {
  animation: view-in 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

body.reader-active {
  padding-bottom: 112px;
}

.new-article-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.new-article-button {
  color: var(--green-dark);
}

/* ---------- landing / input ---------- */

.landing {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(440px, 1.06fr);
  gap: 46px;
  align-items: start;
  padding: 54px 6px 24px;
}

.landing-copy {
  padding-top: 6px;
  animation: rise-in 600ms 60ms both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.landing-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 3.7vw, 3.3rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.landing-copy h1 .headline-line,
.landing-copy h1 .highlight {
  display: inline-block;
  white-space: nowrap;
}

.landing-copy .hero-lead {
  max-width: 590px;
  margin-top: 21px;
  font-size: 0.98rem;
  line-height: 1.82;
}

.landing-points {
  display: grid;
  gap: 0;
  max-width: 590px;
  margin-top: 28px;
  border-top: 1px dashed #ded5c4;
}

.landing-point {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 14px 2px;
  border-bottom: 1px dashed #ded5c4;
}

.point-number {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 0.59rem;
  font-weight: 900;
}

.landing-point strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 900;
}

.landing-point p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.mini-card-parade {
  position: relative;
  width: 290px;
  height: 77px;
  margin-top: 24px;
}

.mini-card {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: #fffdf8;
  border: 1.5px solid #ddd4c1;
  border-radius: 10px;
  box-shadow: 0 3px 0 rgba(101, 87, 57, 0.07);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.mini-card-a {
  top: 8px;
  left: 0;
  transform: rotate(-4deg);
}

.mini-card-b {
  top: 27px;
  left: 101px;
  color: #4f3d8c;
  background: var(--violet-pale);
  border-color: #d8cef7;
  transform: rotate(2deg);
}

.mini-card-c {
  top: 0;
  right: 3px;
  background: var(--yellow-pale);
  border-color: #e8d188;
  transform: rotate(4deg);
}

.mini-star {
  position: absolute;
  right: 36px;
  bottom: 1px;
  color: var(--yellow);
  font-size: 1.2rem;
  text-shadow: 0 1px 0 #b8881c;
  transform: rotate(12deg);
}

.composer-card {
  position: relative;
  padding: 27px;
  background: var(--surface);
  border: 1.5px solid #e7decc;
  border-radius: 27px;
  box-shadow: var(--shadow-md);
  animation: rise-in 680ms 120ms both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.composer-card::after {
  position: absolute;
  right: 26px;
  bottom: -9px;
  left: 26px;
  z-index: -1;
  height: 20px;
  background: rgba(213, 201, 174, 0.22);
  border-radius: 0 0 22px 22px;
  content: "";
}

.composer-accent {
  position: absolute;
  top: 0;
  left: 38px;
  width: 108px;
  height: 5px;
  background: #f6d77a;
  border-radius: 0 0 99px 99px;
}

.composer-head {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.composer-kicker {
  color: var(--green-dark);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.composer-head h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.ai-status {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  max-width: 190px;
  margin-top: 2px;
  padding: 5px 8px;
  color: var(--muted);
  background: #f7f5ee;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.25;
}

.ai-status-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: #b2b9b2;
  border-radius: 50%;
}

.ai-status.is-ready {
  color: #2e7454;
  background: #eef9f2;
  border-color: #d5ecdd;
}

.ai-status.is-ready .ai-status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(84, 180, 134, 0.13);
}

.ai-status.is-warning {
  color: #8b650f;
  background: #fff8df;
  border-color: #efdf9f;
}

.ai-status.is-warning .ai-status-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(244, 189, 63, 0.14);
}

.ai-status.is-error {
  color: #985444;
  background: #fff1ec;
  border-color: #f0d3c9;
}

.ai-status.is-error .ai-status-dot {
  background: var(--peach);
}

.input-label {
  display: block;
  margin: 0 0 7px 2px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 900;
}

.textarea-shell {
  position: relative;
  overflow: hidden;
  background: #fcfaf4;
  border: 1.5px solid #e4dccb;
  border-radius: 16px;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.textarea-shell:focus-within {
  background: #fffefb;
  border-color: #8bc6a7;
  box-shadow: 0 0 0 4px rgba(84, 180, 134, 0.11);
}

.textarea-shell.has-error {
  border-color: #dda28e;
  box-shadow: 0 0 0 4px rgba(221, 162, 142, 0.1);
}

.textarea-shell textarea {
  display: block;
  width: 100%;
  min-height: 236px;
  max-height: 440px;
  padding: 17px 42px 18px 17px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font-ui);
  font-size: 0.94rem;
  line-height: 1.72;
  resize: vertical;
}

.textarea-shell textarea::placeholder {
  color: #a4aea5;
}

.textarea-corner {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: #c3c9c1;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-style: italic;
  pointer-events: none;
}

.input-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 6px 2px 0;
}

.input-hint {
  color: var(--muted-light);
  font-size: 0.61rem;
  font-weight: 700;
}

.input-count {
  color: var(--muted);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.input-count.is-over {
  color: #b5573e;
}

.input-error {
  margin-top: 8px;
  padding: 9px 11px;
  color: #88432f;
  background: #fff2ec;
  border: 1px solid #f0d0c4;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.55;
  animation: soft-pop 220ms ease both;
}

.composer-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 13px;
}

.sample-button,
.analyze-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 47px;
  padding: 10px 16px;
  border-radius: 13px;
  font-size: 0.78rem;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.sample-button {
  color: var(--ink-soft);
  background: #fffdf8;
  border: 1.5px solid var(--line);
  box-shadow: 0 3px 0 rgba(101, 87, 57, 0.06);
}

.sample-button:hover {
  background: #fbf7ec;
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.sample-spark {
  color: var(--yellow-deep);
  font-size: 0.85rem;
}

.analyze-button {
  flex: 1;
  color: #fffdf8;
  background: var(--green-dark);
  border: 1.5px solid #246a4c;
  box-shadow: 0 4px 0 #205d44, 0 9px 20px rgba(42, 112, 79, 0.18);
}

.analyze-button:hover:not(:disabled) {
  background: #338b64;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 #205d44, 0 12px 23px rgba(42, 112, 79, 0.2);
}

.analyze-button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #205d44;
}

.analyze-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.analyze-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-privacy {
  margin: 12px 2px 0;
  color: var(--muted-light);
  font-size: 0.6rem;
  line-height: 1.55;
}

/* ---------- loading ---------- */

.analysis-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 466px;
  padding: 35px 25px 25px;
  text-align: center;
}

.analysis-art {
  position: relative;
  width: 140px;
  height: 116px;
  margin-bottom: 17px;
}

.analysis-card {
  position: absolute;
  display: grid;
  width: 78px;
  height: 53px;
  place-items: center;
  color: var(--ink-soft);
  background: #fffdf8;
  border: 1.5px solid #ddd4c1;
  border-radius: 14px;
  box-shadow: 0 5px 0 rgba(101, 87, 57, 0.08);
  font-family: var(--font-display);
  font-size: 0.83rem;
  font-weight: 900;
}

.analysis-card-one {
  top: 38px;
  left: 8px;
  transform: rotate(-13deg);
  animation: analysis-card-a 2.8s ease-in-out infinite;
}

.analysis-card-two {
  top: 7px;
  left: 35px;
  z-index: 2;
  color: #4f3d8c;
  background: var(--violet-pale);
  border-color: #d8cef7;
  transform: rotate(2deg);
  animation: analysis-card-b 2.4s ease-in-out infinite;
}

.analysis-card-three {
  top: 47px;
  right: 4px;
  color: #79570d;
  background: var(--yellow-pale);
  border-color: #e8d188;
  transform: rotate(12deg);
  animation: analysis-card-c 3s ease-in-out infinite;
}

.analysis-orbit {
  position: absolute;
  top: 8px;
  right: 2px;
  color: var(--yellow);
  font-size: 1.2rem;
  animation: twinkle 1.8s ease-in-out infinite;
}

.analysis-kicker {
  color: var(--green-dark);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.analysis-state h2 {
  margin: 4px 0 7px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.analysis-status {
  min-height: 24px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.analysis-steps {
  display: flex;
  gap: 7px;
  margin-top: 19px;
}

.analysis-steps span {
  width: 7px;
  height: 7px;
  background: #dfded5;
  border-radius: 50%;
  transition: background 200ms ease;
}

.analysis-steps span.is-active {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(84, 180, 134, 0.13);
}

.analysis-bar {
  width: min(280px, 100%);
  height: 6px;
  margin-top: 17px;
  overflow: hidden;
  background: #e9e5da;
  border-radius: 999px;
}

.analysis-bar span {
  display: block;
  width: 44%;
  height: 100%;
  background: linear-gradient(90deg, #5bb98b, #d9cf6a);
  border-radius: inherit;
  animation: analysis-sweep 1.6s ease-in-out infinite;
}

.analysis-time {
  max-width: 300px;
  margin: 12px 0 0;
  color: var(--muted-light);
  font-size: 0.64rem;
  line-height: 1.6;
}

.cancel-analysis {
  margin-top: 20px;
  padding: 7px 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 800;
}

.cancel-analysis:hover {
  color: var(--ink-soft);
  background: #f8f5ec;
}

/* ---------- analysis error ---------- */

.analysis-error {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 15px;
  padding: 13px 14px;
  color: #7f3b2d;
  background: #fff2ec;
  border: 1px solid #efcfc3;
  border-radius: 13px;
  text-align: left;
  animation: soft-pop 240ms ease both;
}

.analysis-error-icon {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #fffdf8;
  background: #d57d63;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 900;
}

.analysis-error strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
}

.analysis-error p {
  margin: 4px 0 0;
  color: #915843;
  font-size: 0.7rem;
  line-height: 1.6;
}

.analysis-error-actions {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}

.analysis-error-actions button {
  padding: 5px 10px;
  color: #81422f;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #e4bbae;
  border-radius: 8px;
  font-size: 0.64rem;
  font-weight: 800;
}

.analysis-error-actions button:first-child {
  color: #fffdf8;
  background: #b9644d;
  border-color: #a95742;
}

/* ---------- input page feature strip ---------- */

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 20px 0 54px;
}

.process-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 18px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(224, 214, 194, 0.82);
  border-radius: 17px;
}

.process-icon {
  display: grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 900;
}

.process-icon-spark {
  color: #5e4a9a;
  background: var(--violet-pale);
}

.process-icon-star {
  color: #8a6109;
  background: var(--yellow-pale);
}

.process-step {
  color: #a0a89f;
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.process-card h3 {
  margin: 2px 0 3px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.process-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.6;
}

/* ---------- reader context bar ---------- */

.reader-view {
  padding-bottom: 18px;
}

.reader-context-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 22px 4px 12px;
}

.back-to-input {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 6px 10px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.74);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 800;
}

.back-to-input:hover {
  background: #fffdf8;
  border-color: var(--line-strong);
}

.back-to-input svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-source-badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 5px 9px;
  color: #5b6c61;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
}

.reader-source-badge::before {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  content: "";
}

.reader-source-badge.is-ai::before {
  background: var(--violet);
}

.reader-source-badge.is-ai {
  color: #5e4a9a;
  background: #f8f5ff;
  border-color: #e2daf9;
}

.drag-guide {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--green-dark);
}

.drag-guide-icon {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: #79570d;
  background: var(--yellow-pale);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 900;
}

.card-token {
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.word-card {
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- uncertain meaning marker ---------- */

.card-token.is-uncertain::after {
  position: absolute;
  top: -7px;
  left: -6px;
  z-index: 3;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #6f4d08;
  background: #fff1b6;
  border: 1px solid #dfc45f;
  border-radius: 50%;
  box-shadow: 0 2px 0 rgba(129, 96, 19, 0.12);
  content: "?";
  font-size: 0.58rem;
  font-weight: 900;
  pointer-events: none;
}

.context-uncertain {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 1px 7px;
  color: #7a5c0d;
  background: #fff3c8;
  border: 1px solid #ecd88a;
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 900;
}

/* ---------- drag favorite ---------- */

body.is-dragging-card {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.card-token.is-dragging-source {
  opacity: 0.25;
}

.card-token.is-dragging-source .word-card {
  border-style: dashed;
  box-shadow: none;
  filter: grayscale(0.3);
  transform: scale(0.94);
}

.drag-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  overflow: hidden;
  pointer-events: none;
}

.drag-ghost {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 2;
  display: inline-flex !important;
  margin: 0 !important;
  vertical-align: middle;
  pointer-events: none !important;
  transform-origin: center center;
  will-change: transform;
  filter: drop-shadow(0 18px 22px rgba(66, 52, 27, 0.22));
}

.drag-ghost .word-card {
  box-shadow:
    inset 0 -3px 0 var(--tone-edge),
    0 12px 0 rgba(101, 87, 57, 0.06),
    0 24px 42px rgba(67, 57, 36, 0.18) !important;
  cursor: grabbing;
}

.drag-ghost .star-button,
.drag-ghost .fav-pin {
  display: none !important;
}

.drag-ghost.is-flying {
  transition:
    transform 430ms cubic-bezier(0.22, 0.8, 0.3, 1),
    opacity 430ms ease;
}

.star-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 70;
  display: flex;
  gap: 12px;
  align-items: center;
  width: min(720px, calc(100vw - 32px));
  min-height: 68px;
  padding: 9px 13px 9px 11px;
  background: rgba(255, 252, 240, 0.96);
  border: 1.5px solid #e8d493;
  border-radius: 21px;
  box-shadow:
    0 6px 0 rgba(126, 99, 38, 0.08),
    0 18px 44px rgba(61, 52, 33, 0.14);
  transform: translateX(-50%);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    transform 220ms cubic-bezier(0.2, 1, 0.4, 1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.dock-glow {
  position: absolute;
  inset: -7px;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(244, 189, 63, 0.23), transparent 68%);
  border-radius: 27px;
  opacity: 0;
  transition: opacity 220ms ease;
}

.dock-jar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 47px;
  height: 47px;
  place-items: center;
  color: #7d5b0d;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(145deg, #fff6cf, #ffe69a);
  border: 1.5px dashed #d5b34f;
  border-radius: 15px;
  transform: rotate(-3deg);
  transition: transform 220ms cubic-bezier(0.2, 1.3, 0.4, 1);
}

.dock-jar-star {
  font-size: 1.15rem;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(146, 104, 15, 0.24);
}

.dock-jar-spark {
  position: absolute;
  top: 2px;
  right: 4px;
  color: var(--green);
  font-size: 0.55rem;
}

.dock-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.dock-copy strong {
  overflow: hidden;
  color: #6f5310;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-copy span {
  overflow: hidden;
  color: #97845d;
  font-size: 0.59rem;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: #7c5a0d;
  background: rgba(255, 248, 219, 0.8);
  border: 1px solid #eedb9d;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}

.dock-count strong {
  font-size: 0.82rem;
  font-weight: 900;
}

.dock-open {
  display: grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  padding: 0;
  place-items: center;
  color: #7a5b13;
  background: #fffdf8;
  border: 1px solid #e4d4a7;
  border-radius: 10px;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.dock-open:hover {
  background: #fff5ce;
  transform: translateX(1px);
}

.dock-open svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.star-dock.is-ready {
  border-color: #dfc25d;
  box-shadow:
    0 6px 0 rgba(126, 99, 38, 0.08),
    0 20px 50px rgba(128, 94, 16, 0.15);
}

.star-dock.is-ready .dock-glow {
  opacity: 0.7;
}

.star-dock.is-near {
  background: rgba(255, 249, 218, 0.98);
  border-color: #d8b53f;
  transform: translateX(-50%) scale(1.015);
}

.star-dock.is-near .dock-glow {
  opacity: 1;
  animation: dock-pulse 1.1s ease-in-out infinite;
}

.star-dock.is-near .dock-jar {
  transform: rotate(2deg) scale(1.08);
}

.star-dock.is-over {
  border-color: #b88d13;
  box-shadow:
    0 7px 0 rgba(126, 99, 38, 0.1),
    0 22px 56px rgba(149, 107, 8, 0.24),
    0 0 0 5px rgba(244, 189, 63, 0.14);
  transform: translateX(-50%) scale(1.025);
}

.star-dock.is-over .dock-jar {
  animation: jar-wiggle 600ms ease-in-out infinite;
}

.star-dock.is-success {
  animation: dock-success 520ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.star-dock.is-miss {
  animation: dock-miss 320ms ease;
}

body.reader-active .toast {
  bottom: 105px;
}

body.reader-active .page-footer {
  padding-bottom: 112px;
}

/* ---------- new keyframes ---------- */

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-pop {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes analysis-card-a {
  0%,
  100% {
    transform: rotate(-13deg) translateY(0);
  }
  50% {
    transform: rotate(-9deg) translateY(-5px);
  }
}

@keyframes analysis-card-b {
  0%,
  100% {
    transform: rotate(2deg) translateY(0) scale(1);
  }
  50% {
    transform: rotate(-1deg) translateY(4px) scale(1.03);
  }
}

@keyframes analysis-card-c {
  0%,
  100% {
    transform: rotate(12deg) translateY(0);
  }
  50% {
    transform: rotate(8deg) translateY(-4px);
  }
}

@keyframes analysis-sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

@keyframes dock-pulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

@keyframes jar-wiggle {
  0%,
  100% {
    transform: rotate(2deg) scale(1.08);
  }
  35% {
    transform: rotate(-4deg) scale(1.1);
  }
  70% {
    transform: rotate(5deg) scale(1.07);
  }
}

@keyframes dock-success {
  0% {
    transform: translateX(-50%) scale(1.02);
  }
  38% {
    transform: translateX(-50%) scale(1.07);
    background: #fff7cc;
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes dock-miss {
  0%,
  100% {
    transform: translateX(-50%);
  }
  35% {
    transform: translateX(calc(-50% - 5px));
  }
  70% {
    transform: translateX(calc(-50% + 4px));
  }
}

/* ---------- phase 2 responsive ---------- */

@media (max-width: 1050px) {
  .landing {
    grid-template-columns: minmax(0, 0.88fr) minmax(400px, 1.12fr);
    gap: 30px;
  }

  .landing-copy h1 {
    font-size: clamp(2.2rem, 3.6vw, 2.85rem);
  }
}

@media (max-width: 860px) {
  .landing {
    grid-template-columns: 1fr;
    gap: 29px;
    padding-top: 42px;
  }

  .landing-copy {
    padding-top: 0;
  }

  .landing-copy .hero-lead {
    max-width: 690px;
  }

  .landing-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: none;
    border-top: 0;
    gap: 10px;
    margin-top: 23px;
  }

  .landing-point {
    flex-direction: column;
    gap: 8px;
    padding: 13px;
    background: rgba(255, 253, 248, 0.64);
    border: 1px solid var(--line);
    border-radius: 13px;
  }

  .mini-card-parade {
    display: none;
  }

  .composer-card {
    width: min(720px, 100%);
    margin: 0 auto;
  }

  .process-strip {
    grid-template-columns: 1fr;
    padding-bottom: 35px;
  }
}

@media (max-width: 620px) {
  .topbar-inner {
    height: 66px;
  }

  .new-article-button,
  .sound-toggle {
    width: 38px;
    justify-content: center;
    padding: 0;
  }

  .new-article-icon {
    width: 18px;
    height: 18px;
  }

  .landing {
    padding: 31px 1px 20px;
    gap: 22px;
  }

  .landing-copy h1 {
    font-size: clamp(1.9rem, 9vw, 2.55rem);
  }

  .landing-copy .hero-lead {
    margin-top: 15px;
    font-size: 0.88rem;
    line-height: 1.75;
  }

  .eyebrow {
    margin-bottom: 13px;
  }

  .landing-points {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 18px;
    border-top: 1px dashed #ded5c4;
  }

  .landing-point {
    flex-direction: row;
    gap: 11px;
    padding: 11px 2px;
    background: transparent;
    border: 0;
    border-bottom: 1px dashed #ded5c4;
    border-radius: 0;
  }

  .point-number {
    width: 27px;
    height: 27px;
  }

  .landing-point p {
    font-size: 0.68rem;
  }

  .composer-card {
    padding: 19px 15px;
    border-radius: 21px;
  }

  .composer-card::after {
    right: 18px;
    left: 18px;
  }

  .composer-accent {
    left: 26px;
    width: 80px;
    height: 4px;
  }

  .composer-head {
    gap: 9px;
    margin-bottom: 16px;
  }

  .composer-head h2 {
    font-size: 1.35rem;
  }

  .ai-status {
    max-width: 142px;
    padding: 4px 7px;
    font-size: 0.52rem;
  }

  .textarea-shell textarea {
    min-height: 210px;
    padding: 14px 30px 14px 14px;
    font-size: 0.88rem;
  }

  .input-meta {
    display: block;
    padding-top: 6px;
  }

  .input-hint {
    display: block;
    font-size: 0.57rem;
  }

  .input-count {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.6rem;
  }

  .composer-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .analyze-button,
  .sample-button {
    width: 100%;
    min-height: 44px;
  }

  .composer-privacy {
    text-align: center;
    font-size: 0.56rem;
  }

  .analysis-state {
    min-height: 410px;
    padding: 24px 10px 18px;
  }

  .analysis-state h2 {
    font-size: 1.2rem;
  }

  .analysis-status {
    font-size: 0.73rem;
  }

  .process-strip {
    padding: 13px 0 28px;
  }

  .process-card {
    padding: 13px;
  }

  .reader-context-bar {
    padding: 14px 2px 9px;
  }

  .back-to-input {
    padding: 5px 8px;
    font-size: 0.64rem;
  }

  .reader-source-badge {
    max-width: 48%;
    overflow: hidden;
    font-size: 0.56rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reader-guide {
    gap: 7px 12px;
  }

  .drag-guide {
    order: 3;
    width: 100%;
    font-size: 0.62rem;
  }

  .drag-guide-icon {
    width: 19px;
    height: 19px;
  }

  .star-dock {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    min-height: 62px;
    padding: 8px 9px 8px 8px;
    border-radius: 18px;
    transform: none;
  }

  .star-dock.is-near {
    transform: scale(1.012);
  }

  .star-dock.is-over {
    transform: scale(1.02);
  }

  .star-dock.is-success {
    animation-name: dock-success-mobile;
  }

  .star-dock.is-miss {
    animation-name: dock-miss-mobile;
  }

  .dock-jar {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .dock-copy strong {
    font-size: 0.68rem;
  }

  .dock-copy span {
    font-size: 0.53rem;
  }

  .dock-count {
    padding: 4px 7px;
    font-size: 0.55rem;
  }

  .dock-count strong {
    font-size: 0.73rem;
  }

  .dock-open {
    width: 32px;
    height: 32px;
  }

  .dock-open svg {
    width: 15px;
    height: 15px;
  }

  body.reader-active {
    padding-bottom: 91px;
  }

  body.reader-active .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  body.reader-active .page-footer {
    padding-bottom: 94px;
  }

  .card-token.is-uncertain::after {
    top: -6px;
    left: -5px;
    width: 16px;
    height: 16px;
  }

  .drag-ghost {
    filter: drop-shadow(0 12px 16px rgba(66, 52, 27, 0.22));
  }
}

@media (max-width: 370px) {
  .brand-copy small {
    display: none;
  }

  .topbar-inner {
    padding: 0 10px;
  }

  .top-actions {
    gap: 4px;
  }

  .stars-button {
    padding-right: 5px;
    padding-left: 8px;
  }

  .dock-copy span {
    display: none;
  }

  .dock-count {
    display: none;
  }
}

@keyframes dock-success-mobile {
  0% {
    transform: scale(1.02);
  }
  38% {
    transform: scale(1.055);
    background: #fff7cc;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes dock-miss-mobile {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(4px);
  }
}
