:root {
  --ink: #1f2933;
  --muted: #65717f;
  --line: #d8dee6;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --accent: #1f6f78;
  --accent-strong: #16545b;
  --warm: #a84d2b;
  --gold: #c8922d;
  --green: #39745d;
  --shadow: 0 12px 36px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.sidebar,
.study-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--surface);
  border-color: var(--line);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  transition:
    padding 180ms ease,
    opacity 180ms ease;
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 248px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 28px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr) 320px;
}

body.sidebar-collapsed .sidebar {
  overflow: hidden;
  padding-right: 0;
  padding-left: 0;
  opacity: 0;
}

body.sidebar-collapsed .sidebar-toggle {
  left: 0;
}

.study-panel {
  border-left: 1px solid var(--line);
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand h1,
.brand p,
.panel-section h2 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.panel-section h2,
.meta,
.empty,
label {
  color: var(--muted);
}

.brand p {
  margin-top: 2px;
  font-size: 13px;
}

.unit-nav {
  display: grid;
  gap: 6px;
}

.unit-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.unit-button:hover,
.unit-button.is-active {
  border-color: #b8d4d8;
  background: #eef7f8;
}

.unit-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #d9eef1;
  font-weight: 800;
}

.unit-title {
  display: block;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-theme {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  padding: 22px 26px 40px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px;
  gap: 12px;
  align-items: end;
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.14);
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 1 / -1;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-width: 64px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tab.is-active {
  color: #fff;
  background: var(--accent);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stats-row div,
.panel-section,
.content-card,
.chunk-card,
.vocab-card,
.grammar-block,
.practice-card,
.result-card,
.game-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stats-row div {
  padding: 14px 16px;
}

.stats-row strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.stats-row span {
  color: var(--muted);
  font-size: 13px;
}

.content {
  display: grid;
  gap: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.content-card,
.chunk-card,
.vocab-card,
.grammar-block,
.practice-card,
.result-card,
.game-card,
.wrong-item {
  padding: 16px;
}

.content-card h2,
.chunk-card h3,
.vocab-card h3,
.grammar-block h3,
.practice-card h3,
.result-card h3,
.game-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: 0;
}

.content-card p,
.chunk-card p,
.vocab-card p,
.grammar-block p,
.practice-card p,
.result-card p,
.game-card p {
  margin: 8px 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #c8d4da;
  border-radius: 999px;
  color: #38515a;
  background: #f3f8f9;
  font-size: 12px;
}

.chunk-list,
.vocab-grid,
.grammar-list {
  display: grid;
  gap: 10px;
}

.chunk-card {
  display: grid;
  gap: 10px;
}

.chunk-card header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.chunk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.text-button {
  min-height: 30px;
  border: 1px solid #bad0d4;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #eef7f8;
  font-size: 13px;
  font-weight: 800;
}

.text-button:hover {
  border-color: var(--accent);
  background: #e2f1f3;
}

.meta {
  font-size: 12px;
}

.pdf-link {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.pdf-link:hover {
  text-decoration: underline;
}

.chunk-summary {
  font-size: 16px;
  cursor: pointer;
}

.chunk-summary:hover {
  color: var(--accent-strong);
}

.exam-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.exam-details summary {
  color: var(--warm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.highlighted-excerpt {
  color: var(--ink);
  font-size: 14px;
}

.workbook-blank {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 4px;
  vertical-align: middle;
}

.workbook-blank input,
.workbook-blank select {
  width: 128px;
  height: 30px;
  border: 0;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  padding: 0 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

.workbook-options {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  border: 1px solid #bad0d4;
  border-radius: 8px;
  padding: 12px;
  background: #eef7f8;
}

.workbook-options > span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.workbook-options div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-chip {
  min-height: 28px;
  border: 1px solid #b8d4d8;
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--accent-strong);
  background: #fff;
  font-weight: 800;
}

mark {
  border-radius: 4px;
  padding: 0 3px;
}

.mark-vocab {
  background: #e3f4ef;
  color: #185c45;
}

.mark-phrase {
  background: #fff0cf;
  color: #6f4e00;
}

.mark-book-phrase {
  background: #dff2ff;
  color: #0b5c7a;
}

.mark-grammar {
  background: #e9e4ff;
  color: #4c3f91;
}

.exam-point-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.exam-point {
  display: grid;
  grid-template-columns: minmax(92px, 0.35fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
}

.exam-point-tag {
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--ink);
  background: #eef2f5;
  font-weight: 800;
}

.exam-point-tag.is-vocab {
  background: #e3f4ef;
  color: #185c45;
}

.exam-point-tag.is-phrase {
  background: #fff0cf;
  color: #6f4e00;
}

.exam-point-tag.is-book-phrase {
  background: #dff2ff;
  color: #0b5c7a;
}

.exam-point-tag.is-grammar {
  background: #e9e4ff;
  color: #4c3f91;
}

.point-scope {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 12px;
}

.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.note-card header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.reader-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
}

.reader-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.reader-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.reader-layout {
  margin-top: 16px;
}

.reader-text,
.reader-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.reader-text {
  min-height: 340px;
  padding: 20px;
  font-size: 18px;
  line-height: 1.85;
}

.reader-text.is-marked {
  background:
    linear-gradient(transparent 95%, rgba(31, 111, 120, 0.1) 95%) 0 0 / 100% 34px,
    #fffef9;
}

.reader-title {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: 22px;
}

.reader-text p {
  margin: 0 0 16px;
}

.reader-text p:last-child {
  margin-bottom: 0;
}

.reader-notes {
  padding: 14px;
}

.reader-notes h3 {
  margin: 0 0 10px;
}

.wrong-save-note {
  color: var(--warm);
  font-weight: 800;
}

.vocab-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.vocab-card strong {
  display: block;
  color: var(--accent-strong);
  font-size: 20px;
}

.grammar-answer {
  color: var(--green);
  font-weight: 700;
}

.practice-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: #fff;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #d9c485;
  border-radius: 999px;
  padding: 2px 12px;
  color: #6e4f05;
  background: #fff8df;
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.practice-submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  border: 1px solid #bad0d4;
  border-radius: 8px;
  padding: 14px;
  background: #eef7f8;
}

.question-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.question-title {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 10px;
  font-weight: 700;
}

.question-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
}

.option-grid {
  display: grid;
  gap: 8px;
}

.option-label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
}

.option-label:has(input:checked) {
  border-color: var(--accent);
  background: #eef7f8;
}

.option-label.is-correct {
  border-color: #8cc3ab;
  background: #eef8f3;
}

.option-label.is-wrong {
  border-color: #e0a392;
  background: #fff2ee;
}

.result-card {
  display: grid;
  gap: 8px;
}

.completion-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--green));
}

.completion-banner strong,
.completion-banner span {
  display: block;
}

.completion-banner strong {
  font-size: 18px;
}

.home-return-button {
  min-height: 40px;
  border: 1px solid #fff;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--accent-strong);
  background: #fff;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.14);
}

.result-score {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.game-scene {
  display: grid;
  gap: 10px;
  overflow: hidden;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: #f7fbfa;
}

.game-scene svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 150px;
}

.game-hud,
.game-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.game-hud div,
.game-result-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.game-hud strong,
.game-result-grid strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.game-hud span,
.game-result-grid span {
  color: var(--muted);
  font-size: 12px;
}

.energy-meter {
  display: flex;
  gap: 6px;
  align-items: center;
}

.energy-meter span {
  display: block;
  width: 24px;
  height: 14px;
  border-radius: 999px;
  background: #dfe7e8;
}

.energy-meter span.is-on {
  background: var(--accent);
}

.game-prompt {
  border: 1px solid #d7e6e3;
  border-radius: 8px;
  padding: 16px;
  background: #f8fbfb;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.45;
}

.game-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.game-option {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.game-option:not(:disabled):hover {
  border-color: var(--accent);
  background: #eef7f8;
}

.game-option.is-correct {
  border-color: #7ab899;
  background: #edf8f2;
}

.game-option.is-wrong {
  border-color: #d9947f;
  background: #fff0ea;
}

.game-feedback {
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.game-feedback.is-correct {
  color: #276844;
  background: #eaf8ef;
}

.game-feedback.is-wrong {
  color: #95472c;
  background: #fff0ea;
}

.game-miss-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.game-miss-list h4 {
  margin: 0;
}

.game-miss-list p {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.wrong-dock {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.wrong-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.wrong-coach {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid #b8d9ce;
  border-radius: 8px;
  padding: 14px;
  background: #f3fbf7;
}

.wrong-coach h4 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 16px;
}

.coach-explanation {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}

.coach-explanation ol {
  margin: 8px 0;
  padding-left: 20px;
}

.coach-explanation li {
  margin: 6px 0;
}

.coach-question-list {
  display: grid;
  gap: 10px;
}

.coach-question {
  border: 1px solid #d4e4e1;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.writing-input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
}

.writing-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.14);
}

.writing-report {
  margin-top: 12px;
}

.writing-report ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.panel-section {
  margin-bottom: 14px;
  padding: 14px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-section h2 {
  font-size: 13px;
  text-transform: uppercase;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: var(--warm);
  font-size: 12px;
  font-weight: 800;
}

.pet-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.pet-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: 172px;
  margin: 0;
  padding: 10px;
  box-shadow: var(--shadow);
  transition:
    width 180ms ease,
    transform 180ms ease;
}

.pet-widget.is-expanded {
  width: 270px;
}

.pet-widget.is-collapsed .history-list {
  display: none;
}

.pet-widget.is-collapsed .panel-heading h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.pet-stage,
.pet-mini-stage {
  display: grid;
  place-items: center;
  border: 1px solid #d7e4dc;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f4fbf8 0%, #fff 100%);
}

.pet-stage {
  min-height: 150px;
}

.pet-compact {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.pet-mini-stage {
  width: 42px;
  height: 38px;
}

.pet-creature {
  position: relative;
  width: var(--pet-size, 74px);
  height: calc(var(--pet-size, 74px) * 0.86);
  border: 2px solid #315d50;
  border-radius: 46% 46% 38% 38%;
  background: var(--pet-color, #8cc3ab);
  box-shadow: 0 12px 0 rgba(49, 93, 80, 0.12);
}

.pet-creature::before,
.pet-creature::after {
  content: "";
  position: absolute;
  top: 35%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #18312a;
}

.pet-creature::before {
  left: 24%;
}

.pet-creature::after {
  right: 24%;
}

.pet-spark {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid var(--gold);
  border-radius: 4px;
  transform: translateX(-50%) rotate(45deg);
  background: #fff5ce;
}

.pet-name {
  margin: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-compact-info {
  min-width: 0;
}

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

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.pet-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pet-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.pet-stats strong {
  display: block;
  font-size: 18px;
}

.practice-dock {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.practice-dock-score {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.practice-dock-score div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.practice-dock-score strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.dock-button {
  width: 100%;
}

.pet-chat {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 164px;
  max-height: 240px;
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.chat-message {
  max-width: 92%;
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-message p {
  margin: 0;
  font-size: 13px;
}

.chat-message.is-pet {
  justify-self: start;
  border: 1px solid #c9ddd5;
  background: #eef8f3;
}

.chat-message.is-user {
  justify-self: end;
  color: #fff;
  background: var(--accent);
}

.chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-links a {
  border: 1px solid #bad0d4;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.pet-ask-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.pet-ask-form input {
  min-width: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #fff;
}

.flash-card {
  margin-top: 14px;
}

.flash-word {
  display: block;
  color: var(--accent-strong);
  font-size: 26px;
  font-weight: 800;
}

.flash-meaning {
  margin: 8px 0 12px;
  color: var(--warm);
  font-weight: 700;
}

.quick-links {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quick-links button {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  padding: 8px 10px;
}

.quick-links button:hover {
  border-color: #b8d4d8;
  background: #eef7f8;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .sidebar-toggle {
    left: 208px;
  }

  .study-panel {
    grid-column: 1 / -1;
    position: static;
    height: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .toolbar {
    grid-template-columns: minmax(220px, 1fr) 160px;
  }

  .view-tabs {
    width: max-content;
  }

  .pet-widget {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-toggle {
    top: 16px;
    left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transform: none;
  }

  body.sidebar-collapsed .sidebar {
    display: none;
  }

  .unit-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 18px 14px 28px;
  }

  .toolbar,
  .stats-row,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    width: 100%;
  }

  .tab {
    flex: 1 1 30%;
    min-width: 72px;
  }

  .chunk-card header {
    display: grid;
  }

  .chunk-actions {
    justify-content: flex-start;
  }

  .reader-layout {
    grid-template-columns: 1fr;
  }

  .reader-text {
    min-height: 260px;
    font-size: 16px;
  }

  .pet-widget,
  .pet-widget.is-expanded {
    right: 10px;
    bottom: 10px;
    width: min(270px, calc(100vw - 20px));
  }

  .exam-point {
    grid-template-columns: 1fr;
  }

  .note-card header {
    display: grid;
  }

  .game-options,
  .game-hud,
  .game-result-grid {
    grid-template-columns: 1fr;
  }

  .game-prompt {
    font-size: 18px;
  }
}
