:root {
  color-scheme: light;
  --bg: #fff1f2;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #fecdd3;
  --brand: #f43f5e;
  --brand-dark: #be123c;
  --soft: #ffe4e6;
  --done: #16a34a;
  --shadow: 0 18px 45px rgba(159, 18, 57, 0.12);
  --paper-bg: #fff7fa;
  --paper-desk: #ffdbe4;
  --grid-line: #f9a8d4;
  --grid-faint: rgba(249, 168, 212, 0.62);
  --cat-fur: #f9a8d4;
  --cat-head: #fbcfe8;
  --cat-belly: #ffe4f1;
  --cat-stroke: #be185d;
  --cat-inner: #fb7185;
}

body[data-theme="warm"] {
  --bg: #fff7ed;
  --line: #f1d9bd;
  --brand: #f97316;
  --brand-dark: #c2410c;
  --soft: #ffedd5;
  --shadow: 0 18px 45px rgba(124, 45, 18, 0.12);
  --paper-bg: #fffefb;
  --paper-desk: #f5dfc5;
  --grid-line: #f2c7a0;
  --grid-faint: rgba(242, 199, 160, 0.65);
  --cat-fur: #d8a36a;
  --cat-head: #e7b57d;
  --cat-belly: #f7d9b8;
  --cat-stroke: #8b5e34;
  --cat-inner: #f4a7a7;
}

body[data-theme="green"] {
  --bg: #f0fdf4;
  --line: #bbf7d0;
  --brand: #22c55e;
  --brand-dark: #15803d;
  --soft: #dcfce7;
  --shadow: 0 18px 45px rgba(20, 83, 45, 0.12);
}

body[data-theme="blue"] {
  --bg: #eff6ff;
  --line: #bfdbfe;
  --brand: #3b82f6;
  --brand-dark: #1d4ed8;
  --soft: #dbeafe;
  --shadow: 0 18px 45px rgba(30, 64, 175, 0.12);
}

body[data-theme="pink"] {
  --bg: #fff1f2;
  --line: #fecdd3;
  --brand: #f43f5e;
  --brand-dark: #be123c;
  --soft: #ffe4e6;
  --shadow: 0 18px 45px rgba(159, 18, 57, 0.12);
  --paper-bg: #fff7fa;
  --paper-desk: #ffdbe4;
  --grid-line: #f9a8d4;
  --grid-faint: rgba(249, 168, 212, 0.62);
  --cat-fur: #f9a8d4;
  --cat-head: #fbcfe8;
  --cat-belly: #ffe4f1;
  --cat-stroke: #be185d;
  --cat-inner: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--brand) 24%, transparent), transparent 34rem),
    var(--bg);
  color: var(--ink);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

.header-tools {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.theme-picker {
  display: grid;
  gap: 0.35rem;
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.theme-picker select {
  min-width: 6.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.2rem 1.25rem 1rem;
}

.app-header h1,
.panel h2 {
  margin: 0;
}

.app-header h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--brand-dark);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subtitle,
.helper {
  color: var(--muted);
  line-height: 1.7;
}

.subtitle {
  margin: 0.65rem 0 0;
}

.summary-card {
  min-width: 8.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  text-align: center;
}

.summary-card span {
  display: block;
  color: var(--brand-dark);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}

.summary-card small {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
  width: 100%;
  min-height: calc(100vh - 8.5rem);
  margin: 0;
  padding: 0 1.25rem 1.25rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.article-list-panel,
.reader-panel,
.add-panel {
  padding: 1rem;
}

.article-list-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  height: calc(100vh - 9.75rem);
}

.reader-panel {
  min-width: 0;
  display: flex;
  min-height: calc(100vh - 9.75rem);
  flex-direction: column;
}

.add-panel {
  grid-column: 1 / -1;
}

.panel-heading,
.reader-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.page-status {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
}

.article-list {
  display: grid;
  gap: 0.6rem;
  max-height: calc(100vh - 15.5rem);
  overflow: auto;
  padding-right: 0.2rem;
}

.article-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.75rem;
  width: 100%;
  padding: 0.85rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: var(--paper-bg);
  color: var(--ink);
  text-align: left;
}

.article-button:hover,
.article-button.active {
  border-color: var(--brand);
  background: var(--soft);
}

.article-button strong {
  font-size: 1rem;
}

.article-button small {
  color: var(--muted);
}

.done-badge {
  align-self: start;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.reader-body {
  flex: 1;
  min-height: 0;
  padding: 1rem;
  border-radius: 1.2rem;
  background: var(--paper-desk);
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.1rem;
}

.text-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.55rem, 1vw, 0.9rem) clamp(0.35rem, 0.75vw, 0.58rem);
  align-items: flex-end;
  align-content: flex-start;
  justify-content: flex-start;
  line-height: 1;
}

.page-sheet {
  width: min(100%, 72rem);
  min-height: calc(100vh - 15rem);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 2rem);
  border: 1px solid var(--grid-line);
  border-radius: 0.8rem;
  background: var(--paper-bg);
  box-shadow: var(--shadow);
}

.sheet-title {
  margin-bottom: 1rem;
  color: var(--brand-dark);
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
}

.pinyin-loading {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.85rem;
  color: var(--brand-dark);
  font-weight: 900;
  text-align: center;
}

.pinyin-loading p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.word-card {
  display: inline-flex;
  width: 3rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  text-align: center;
}

.pinyin-grid {
  position: relative;
  display: flex;
  width: 3rem;
  height: 1.18rem;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--grid-line);
  border-left: 1px solid var(--grid-line);
  background:
    linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px),
    linear-gradient(to bottom, transparent calc(33.333% - 0.5px), var(--grid-line) calc(33.333% - 0.5px) calc(33.333% + 0.5px), transparent calc(33.333% + 0.5px)),
    linear-gradient(to bottom, transparent calc(66.666% - 0.5px), var(--grid-line) calc(66.666% - 0.5px) calc(66.666% + 0.5px), transparent calc(66.666% + 0.5px)),
    linear-gradient(to bottom, transparent calc(100% - 1px), var(--grid-line) calc(100% - 1px));
  background-color: var(--paper-bg);
}

.tianzi-grid {
  display: flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--grid-line);
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), var(--grid-line) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--grid-line) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(45deg, transparent calc(50% - 0.5px), var(--grid-faint) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), var(--grid-faint) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  background-color: var(--paper-bg);
}

.hanzi {
  font-size: 2.08rem;
  font-weight: 800;
  line-height: 1;
}

.pinyin {
  line-height: 1.25;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.punctuation,
.paragraph-break {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.8rem;
  min-height: 4.3rem;
  font-size: 1.7rem;
  font-weight: 800;
}

.paragraph-break {
  flex-basis: 100%;
  min-height: 0.5rem;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.primary-button {
  padding: 0.75rem 1.1rem;
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 16px color-mix(in srgb, var(--brand) 24%, transparent);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.ghost-button {
  padding: 0.55rem 0.85rem;
  background: var(--soft);
  color: var(--brand-dark);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.add-form {
  display: grid;
  gap: 1rem;
}

.article-modal {
  width: min(92vw, 42rem);
  max-height: 90vh;
  border: 0;
  border-radius: 1.5rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.article-modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-heading,
.modal-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.modal-heading {
  margin-bottom: 0.75rem;
}

.modal-heading h2 {
  margin: 0;
}

.modal-actions {
  justify-content: flex-end;
}

.modal-close {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.add-form label {
  display: grid;
  gap: 0.45rem;
  color: #344054;
  font-weight: 800;
}

.add-form input,
.add-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.8rem 0.9rem;
  background: var(--paper-bg);
  color: var(--ink);
  outline: none;
}

.add-form input:focus,
.add-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}

.form-message {
  min-height: 1.5rem;
  margin: 0;
  color: var(--brand-dark);
  font-weight: 700;
}

.reading-assistant {
  position: fixed;
  right: 1.15rem;
  bottom: 1rem;
  z-index: 20;
  display: grid;
  justify-items: end;
  gap: 0.45rem;
  pointer-events: none;
  perspective: 520px;
}

.reading-assistant::after {
  content: "";
  position: absolute;
  right: 6.3rem;
  bottom: 6.4rem;
  min-width: 1.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(0.3rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.reading-assistant[data-state="waiting"]::after {
  content: "...";
  opacity: 1;
  transform: translateY(0);
}

.reading-assistant[data-state="jumping"]::after {
  content: "**";
  opacity: 1;
  transform: translateY(0);
}

.reading-assistant[data-state="failed"]::after {
  content: "!?";
  opacity: 1;
  transform: translateY(0);
}

.reading-assistant[data-state="waving"]::after,
.reading-assistant[data-state="review"]::after {
  content: "GO";
  opacity: 1;
  transform: translateY(0);
}

.assistant-bubble {
  max-width: 14rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 1rem 1rem 0.25rem 1rem;
  background: white;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
  transform-origin: right bottom;
  animation: bubbleFloat 4s ease-in-out infinite;
}

.cat-speed-toggle {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  background: var(--brand);
  color: white;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.pet-controls {
  position: relative;
  display: grid;
  justify-items: end;
  pointer-events: auto;
}

.pet-panel-toggle {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  background: white;
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.pet-control-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  display: grid;
  gap: 0.55rem;
  width: min(16rem, calc(100vw - 2rem));
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.4rem) scale(0.98);
  transform-origin: right bottom;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.reading-assistant.is-controls-open .pet-control-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.pet-growth-card {
  display: grid;
  gap: 0.42rem;
  padding: 0.65rem;
  border-radius: 0.85rem;
  background: var(--paper-bg);
  color: var(--ink);
}

.pet-growth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.pet-exp-bar {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.pet-exp-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  transition: width 220ms ease;
}

.pet-growth-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.pet-feed-button {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  background: var(--brand);
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
}

.pet-feed-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.pet-switcher {
  display: grid;
  gap: 0.35rem;
  width: 100%;
}

.pet-switcher label {
  color: var(--brand-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.pet-switcher-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
}

.pet-switcher select,
.pet-switcher button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.pet-switcher select {
  max-width: 100%;
  padding: 0.42rem 0.62rem;
}

.pet-switcher button {
  padding: 0.42rem 0.58rem;
}

.assistant-button {
  width: 7.4rem;
  height: 7.4rem;
  border: 0;
  background: transparent;
  pointer-events: auto;
  filter: drop-shadow(0 14px 18px color-mix(in srgb, var(--brand-dark) 20%, transparent));
  transform-style: preserve-3d;
  animation: assistantWalk 7.5s ease-in-out infinite;
}

.assistant-button[data-pet-mode="petdex"] {
  width: 7.6rem;
  height: 8.2rem;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
}

.pet-sprite-frame.assistant-pet-frame {
  --pet-scale: 0.38;
  display: block;
  width: calc(192px * var(--pet-scale));
  height: calc(208px * var(--pet-scale));
  overflow: hidden;
  transform-origin: center;
  transition: transform 180ms ease;
}

.pet-sprite.assistant-pet-sprite {
  --sprite-row: 0;
  --sprite-frames: 6;
  --sprite-duration: 1100ms;
  --sprite-y: calc(var(--sprite-row) * -208px);
  --sprite-end-x: calc(var(--sprite-frames) * -192px);
  display: block;
  width: 192px;
  height: 208px;
  background-image: var(--sprite-url);
  background-repeat: no-repeat;
  background-size: 1536px 1872px;
  image-rendering: pixelated;
  transform: scale(var(--pet-scale));
  transform-origin: top left;
  animation: pet-state var(--sprite-duration) steps(var(--sprite-frames)) infinite;
}

@keyframes pet-state {
  from {
    background-position: 0 var(--sprite-y);
  }

  to {
    background-position: var(--sprite-end-x) var(--sprite-y);
  }
}

.reading-assistant.is-running .assistant-button {
  animation: assistantRun 3.2s ease-in-out infinite;
}

.assistant-button.cheer {
  animation: assistantCheer 650ms ease;
}

.assistant-svg {
  width: 100%;
  height: 100%;
}

.assistant-shadow {
  fill: color-mix(in srgb, var(--brand-dark) 18%, transparent);
}

.assistant-book {
  fill: var(--paper-bg);
}

.cat-body,
.cat-head,
.cat-tail,
.cat-leg {
  fill: var(--cat-fur);
  stroke: var(--cat-stroke);
  stroke-width: 3;
  stroke-linejoin: round;
}

.cat-body,
.cat-head,
.cat-belly,
.cat-muzzle,
.cat-ear-inner,
.cat-stripe,
.assistant-eye,
.cat-nose,
.assistant-smile,
.cat-whisker {
  animation: catBodyStep 900ms ease-in-out infinite;
}

.cat-head {
  fill: var(--cat-head);
}

.cat-muzzle {
  fill: var(--paper-bg);
}

.cat-belly {
  fill: var(--cat-belly);
  stroke: color-mix(in srgb, var(--cat-stroke) 55%, transparent);
  stroke-width: 2;
}

.cat-ear-inner,
.cat-nose {
  fill: var(--cat-inner);
}

.assistant-eye {
  fill: #1f2933;
  transform-origin: center;
  animation: assistantBlink 4.5s infinite;
}

.assistant-smile,
.cat-whisker,
.cat-stripe,
.assistant-book-line {
  fill: none;
  stroke: #1f2933;
  stroke-width: 4;
  stroke-linecap: round;
}

.cat-whisker {
  stroke-width: 3;
}

.assistant-smile {
  transform-origin: 62px 70px;
  transition: transform 180ms ease;
}

.cat-stripe {
  stroke: var(--cat-stroke);
  stroke-width: 3;
}

.assistant-button.cheer .cat-tail {
  animation: tailWag 650ms ease;
  transform-origin: 86px 79px;
}

.assistant-button.cheer .cat-leg.left {
  animation: waveLeft 650ms ease;
  transform-origin: 45px 96px;
}

.assistant-button.cheer .cat-leg.right {
  animation: waveRight 650ms ease;
  transform-origin: 79px 96px;
}

.cat-leg.front-left,
.cat-leg.hind-right {
  transform-origin: 58px 87px;
  animation: catStepForward 900ms ease-in-out infinite;
}

.cat-leg.front-right,
.cat-leg.hind-left {
  transform-origin: 66px 87px;
  animation: catStepBack 900ms ease-in-out infinite;
}

.cat-tail {
  animation: tailWalk 900ms ease-in-out infinite;
  transform-origin: 87px 82px;
}

.reading-assistant.is-running .cat-body,
.reading-assistant.is-running .cat-head,
.reading-assistant.is-running .cat-belly,
.reading-assistant.is-running .cat-muzzle,
.reading-assistant.is-running .cat-ear-inner,
.reading-assistant.is-running .cat-stripe,
.reading-assistant.is-running .assistant-eye,
.reading-assistant.is-running .cat-nose,
.reading-assistant.is-running .assistant-smile,
.reading-assistant.is-running .cat-whisker {
  animation-duration: 420ms;
}

.reading-assistant.is-running .cat-leg.front-left,
.reading-assistant.is-running .cat-leg.hind-right {
  animation: catRunForward 420ms ease-in-out infinite;
}

.reading-assistant.is-running .cat-leg.front-right,
.reading-assistant.is-running .cat-leg.hind-left {
  animation: catRunBack 420ms ease-in-out infinite;
}

.reading-assistant.is-running .cat-tail {
  animation: tailRun 420ms ease-in-out infinite;
}

.reading-assistant[data-state="running"] .assistant-eye,
.reading-assistant[data-state="running-right"] .assistant-eye,
.reading-assistant[data-state="running-left"] .assistant-eye {
  transform: scaleY(0.7) translateY(0.6px);
}

.reading-assistant[data-state="waiting"] .assistant-eye {
  transform: translateY(-0.8px) scaleY(0.78);
}

.reading-assistant[data-state="waiting"] .assistant-smile {
  transform: scaleX(0.86) translateY(1px);
}

.reading-assistant[data-state="jumping"] .assistant-eye {
  transform: scaleY(0.66) translateY(1px);
}

.reading-assistant[data-state="jumping"] .assistant-smile {
  transform: scale(1.06) translateY(-0.4px);
}

.reading-assistant[data-state="failed"] .assistant-eye {
  transform: translateY(1px) scaleY(1.12);
}

.reading-assistant[data-state="failed"] .assistant-smile {
  transform: scaleY(-1);
}

.reading-assistant[data-state="review"] .assistant-eye,
.reading-assistant[data-state="waving"] .assistant-eye {
  transform: scaleX(0.92) translateY(-0.4px);
}

.reading-assistant[data-state="running"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame,
.reading-assistant[data-state="running-right"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame,
.reading-assistant[data-state="running-left"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame {
  transform: translateY(-1px) scale(1.01);
}

.reading-assistant[data-state="waiting"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame {
  transform: scale(0.98);
}

.reading-assistant[data-state="jumping"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame {
  transform: scale(1.04);
}

.reading-assistant[data-state="failed"] .assistant-button[data-pet-mode="petdex"] .assistant-pet-frame {
  transform: scale(0.98) translateY(1px);
}

@keyframes assistantWalk {
  0% {
    transform: translate3d(0, 0, 0) rotateY(0deg) rotate(-1deg);
  }
  25% {
    transform: translate3d(-0.45rem, -0.22rem, 10px) rotateY(-8deg) rotate(1deg);
  }
  50% {
    transform: translate3d(-0.9rem, 0, 0) rotateY(0deg) rotate(-1deg);
  }
  75% {
    transform: translate3d(-0.45rem, -0.22rem, 10px) rotateY(8deg) rotate(1deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotateY(0deg) rotate(-1deg);
  }
}

@keyframes assistantRun {
  0% {
    transform: translate3d(0, 0, 0) rotateY(0deg) rotate(-2deg);
  }
  25% {
    transform: translate3d(-0.8rem, -0.45rem, 18px) rotateY(-14deg) rotate(3deg);
  }
  50% {
    transform: translate3d(-1.6rem, 0, 0) rotateY(0deg) rotate(-2deg);
  }
  75% {
    transform: translate3d(-0.8rem, -0.45rem, 18px) rotateY(14deg) rotate(3deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotateY(0deg) rotate(-2deg);
  }
}

@keyframes catBodyStep {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1.4px);
  }
}

@keyframes catStepForward {
  0%,
  100% {
    transform: rotate(9deg) translate(1px, 0);
  }
  50% {
    transform: rotate(-12deg) translate(-2px, -2px);
  }
}

@keyframes catStepBack {
  0%,
  100% {
    transform: rotate(-10deg) translate(-1px, -1px);
  }
  50% {
    transform: rotate(12deg) translate(2px, 0);
  }
}

@keyframes catRunForward {
  0%,
  100% {
    transform: rotate(18deg) translate(3px, 1px);
  }
  50% {
    transform: rotate(-24deg) translate(-4px, -5px);
  }
}

@keyframes catRunBack {
  0%,
  100% {
    transform: rotate(-20deg) translate(-3px, -2px);
  }
  50% {
    transform: rotate(25deg) translate(4px, 1px);
  }
}

@keyframes tailWalk {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(7deg);
  }
}

@keyframes tailRun {
  0%,
  100% {
    transform: rotate(-12deg);
  }
  50% {
    transform: rotate(16deg);
  }
}

@keyframes bubbleFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.25rem);
  }
}

@keyframes assistantBlink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.12);
  }
}

@keyframes assistantCheer {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotateY(0deg) scale(1);
  }
  45% {
    transform: translate3d(0, -1rem, 24px) rotateY(-12deg) scale(1.08);
  }
}

@keyframes waveLeft {
  50% {
    transform: rotate(-18deg) translate(-0.25rem, -0.4rem);
  }
}

@keyframes waveRight {
  50% {
    transform: rotate(18deg) translate(0.25rem, -0.4rem);
  }
}

@keyframes tailWag {
  50% {
    transform: rotate(12deg);
  }
}

@media (max-width: 860px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: initial;
  }

  .article-list-panel,
  .reader-panel {
    position: static;
    height: auto;
    min-height: initial;
  }

  .article-list {
    max-height: 18rem;
  }

  .page-sheet {
    min-height: 36rem;
  }

  .reading-assistant {
    right: 0.6rem;
    bottom: 0.6rem;
  }

  .pet-switcher {
    width: 12rem;
  }

  .assistant-button {
    width: 5.5rem;
    height: 5.5rem;
  }
}
