:root {
  color-scheme: light;
  --ink: #17182f;
  --soft-ink: #343654;
  --muted: #737892;
  --faint: #9aa0b8;
  --page: #f6f3ff;
  --page-2: #eef2ff;
  --panel: rgba(255, 255, 255, 0.66);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(120, 111, 190, 0.16);
  --line-strong: rgba(120, 111, 190, 0.26);
  --indigo: #5b5bd6;
  --violet: #8b7cff;
  --violet-soft: #d9ccff;
  --blue-soft: #eef2ff;
  --mint-soft: rgba(216, 250, 244, 0.88);
  --danger-soft: #ffe8f0;
  --shadow: 0 24px 70px rgba(62, 57, 122, 0.12);
  --shadow-soft: 0 14px 34px rgba(62, 57, 122, 0.08);
  --radius: 26px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", ui-sans-serif,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 420;
  background:
    radial-gradient(circle at 12% 0%, rgba(217, 204, 255, 0.55), transparent 32%),
    radial-gradient(circle at 82% 12%, rgba(205, 215, 255, 0.58), transparent 34%),
    linear-gradient(135deg, #f6f3ff 0%, #eef2ff 48%, #faf8ff 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.48) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.44) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 70%);
}

button,
textarea,
input {
  font: inherit;
}

select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  width: min(1540px, calc(100% - 64px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.app-layout {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.2);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 22px;
  transition:
    transform 180ms var(--ease),
    filter 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.brand-lockup:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 14px 24px rgba(91, 91, 214, 0.12));
}

.brand-lockup:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 7px rgba(139, 124, 255, 0.12);
}

.brand-lockup img {
  width: min(300px, 34vw);
  max-height: 112px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 12px 28px rgba(91, 91, 214, 0.1));
}

.brand-slogan {
  max-width: 420px;
  margin: 0;
  color: #4f5372;
  font-size: clamp(1rem, 1.35vw, 1.22rem);
  font-weight: 520;
  line-height: 1.55;
  letter-spacing: 0;
}

.brand-slogan::first-letter {
  color: var(--indigo);
}

.account-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.language-switcher {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(91, 91, 214, 0.18);
  border-radius: 999px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 24px rgba(62, 57, 122, 0.06);
}

.language-switcher button {
  border: 0;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--soft-ink);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.language-switcher button.active {
  color: #fff;
  background: var(--indigo);
}

.account-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.account-name,
.role-badge,
.quota-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
  font-weight: 620;
  box-shadow: 0 8px 24px rgba(62, 57, 122, 0.06);
}

.role-badge {
  color: #4f46c8;
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.88), rgba(217, 204, 255, 0.72));
}

.role-badge.guest {
  color: #737892;
  background: rgba(255, 255, 255, 0.56);
}

.role-badge.admin {
  color: #4b3bc4;
  background: linear-gradient(135deg, rgba(217, 204, 255, 0.82), rgba(238, 242, 255, 0.86));
}

.quota-badge {
  color: #5f6381;
}

.account-name {
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(1.12);
}

.main-view {
  min-width: 0;
}

.nav-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0 13px;
  text-align: left;
  color: #5f6381;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 560;
  transition:
    transform 180ms var(--ease),
    color 180ms var(--ease),
    background 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.nav-button:hover {
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.58);
  transform: translateY(-1px);
}

.nav-button.active {
  color: white;
  background: linear-gradient(135deg, rgba(139, 124, 255, 0.86), rgba(91, 91, 214, 0.82));
  box-shadow: 0 12px 26px rgba(91, 91, 214, 0.18);
}

.eyebrow {
  margin: 0 0 9px;
  color: #8b7cff;
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: #8b7cff;
}

.workspace,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(26px) saturate(1.1);
}

.workspace {
  position: relative;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(246, 243, 255, 0.56)),
    radial-gradient(circle at 92% 8%, rgba(217, 204, 255, 0.34), transparent 34%);
  box-shadow: var(--shadow);
}

.workspace::after {
  content: "";
  position: absolute;
  inset: 1px;
  pointer-events: none;
  border-radius: 25px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.46), transparent 42%);
}

.section-title,
.toolbar,
.panel-header,
.expression-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-title,
.toolbar,
.workspace textarea {
  position: relative;
  z-index: 1;
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2,
.panel-header h2 {
  margin: 0;
  color: #17182f;
  font-size: 1.18rem;
  font-weight: 680;
  letter-spacing: 0;
}

#inputMode,
.panel-header > span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid rgba(139, 124, 255, 0.14);
  border-radius: 999px;
  padding: 0 13px;
  color: #5b5bd6;
  background: rgba(238, 242, 255, 0.74);
  font-size: 0.8rem;
  font-weight: 640;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 22px 24px;
  color: var(--ink);
  line-height: 1.78;
  border: 1px solid rgba(139, 124, 255, 0.16);
  border-radius: 24px;
  outline: none;
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 18px 42px rgba(62, 57, 122, 0.08);
  transition:
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease),
    background 180ms var(--ease);
}

textarea:disabled,
textarea[readonly] {
  color: #858aa3;
  background: rgba(255, 255, 255, 0.44);
}

textarea:focus {
  border-color: rgba(139, 124, 255, 0.42);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 0 0 7px rgba(139, 124, 255, 0.1),
    0 22px 50px rgba(62, 57, 122, 0.12);
}

.toolbar {
  margin-top: 18px;
}

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

.primary-button,
.secondary-button,
.save-button,
.text-button,
.delete-button,
.mini-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 650;
  transition:
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease),
    filter 180ms var(--ease),
    background 180ms var(--ease);
}

.primary-button {
  min-width: 132px;
  color: white;
  background: linear-gradient(135deg, #b8abff, #5b5bd6);
  box-shadow: 0 16px 34px rgba(91, 91, 214, 0.2);
}

.secondary-button,
.text-button,
.mini-button {
  color: #5b5bd6;
  background: rgba(238, 242, 255, 0.76);
}

.save-button {
  color: #385e5a;
  background: rgba(216, 250, 244, 0.78);
}

.delete-button {
  color: #b44268;
  background: var(--danger-soft);
  min-width: max-content;
  white-space: nowrap;
}

.primary-button:hover,
.secondary-button:hover,
.save-button:hover,
.text-button:hover,
.mini-button:hover,
.delete-button:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
  box-shadow: 0 16px 32px rgba(91, 91, 214, 0.15);
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 24, 47, 0.28);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(780px, 100%);
  max-height: min(740px, calc(100vh - 48px));
  overflow: auto;
}

.auth-panel {
  width: min(560px, 100%);
}

.auth-hint {
  margin: -4px 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 560;
}

.auth-form input {
  min-height: 48px;
  width: 100%;
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 16px;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(139, 124, 255, 0.42);
  box-shadow: 0 0 0 6px rgba(139, 124, 255, 0.1);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(139, 124, 255, 0.16);
}

.auth-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.auth-code-row button {
  min-height: 48px;
}

.auth-inline-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-inline-status.is-error {
  color: #b44268;
}

#sendRegisterCodeBtn:disabled,
#sendRegisterCodeBtn.is-sent {
  cursor: default;
  color: #777b8f;
  border-color: rgba(119, 123, 143, 0.18);
  background: rgba(220, 222, 229, 0.72);
  box-shadow: none;
  filter: none;
  transform: none;
}

.admin-analytics {
  display: grid;
  gap: 24px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.admin-stat,
.admin-grid > section,
.admin-event-table {
  padding: 16px;
  border: 1px solid rgba(139, 124, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.admin-stat {
  display: grid;
  gap: 8px;
}

.admin-stat span,
.admin-list small,
.admin-event-table time {
  color: var(--muted);
}

.admin-stat strong {
  font-size: 1.65rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.admin-list,
.admin-event-table {
  display: grid;
  gap: 10px;
}

.admin-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.admin-event-table > div {
  display: grid;
  grid-template-columns: 150px 180px 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(139, 124, 255, 0.1);
  overflow-wrap: anywhere;
}

.forbidden-message {
  min-height: 180px;
  place-items: center;
  color: #a23b57;
  font-weight: 650;
}

.toast {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 60;
  padding: 12px 16px;
  color: white;
  background: linear-gradient(135deg, #b8abff, #5b5bd6);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 640;
}

.selection-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(139, 124, 255, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 22px 46px rgba(62, 57, 122, 0.16);
  backdrop-filter: blur(18px);
}

.selection-menu .mini-button {
  justify-content: flex-start;
  text-align: left;
}

.selection-menu.hidden {
  display: none;
}

.definition-card {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 10px;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 18px 20px;
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.definition-card strong {
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.2;
}

.definition-card span {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 620;
}

.definition-card.hidden {
  display: none;
}

.highlight-delete-menu {
  position: fixed;
  z-index: 90;
  padding: 8px;
  border: 1px solid rgba(180, 66, 104, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.highlight-delete-menu.hidden {
  display: none;
}

.highlight-delete-menu .delete-button {
  color: #fff;
  background: #d84f78;
}

.library-item.custom-expression {
  border-color: rgba(139, 124, 255, 0.24);
}

.undo-item {
  border-style: dashed;
  background: rgba(246, 243, 255, 0.58);
}

.library-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.library-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}

.library-controls select {
  min-height: 42px;
  border: 1px solid rgba(139, 124, 255, 0.16);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.7);
}

.mastery-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mastery-strip span,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #5b5bd6;
  background: rgba(238, 242, 255, 0.82);
  font-size: 0.82rem;
  font-weight: 650;
}

.practice-answer {
  min-height: 110px;
  margin-top: 16px;
  border-radius: 18px;
  box-shadow: none;
}

.polish-result {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(139, 124, 255, 0.14);
  border-radius: 18px;
  background: rgba(246, 243, 255, 0.62);
}

.polish-result h4 {
  margin: 0;
  color: var(--ink);
}

.diff-view {
  display: grid;
  gap: 8px;
  line-height: 1.8;
}

.exercise-book-item {
  display: grid;
  gap: 14px;
}

.exercise-source,
.exercise-diff-block {
  display: grid;
  gap: 8px;
}

.exercise-source h4,
.exercise-diff-block h4 {
  margin: 0;
  color: var(--ink);
}

.exercise-source p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.sentence-bank-item {
  display: grid;
  gap: 12px;
}

.sentence-bank-en,
.sentence-bank-zh {
  margin: 0;
  line-height: 1.75;
}

.sentence-bank-en {
  color: var(--ink);
}

.sentence-bank-zh {
  color: var(--muted);
}

.exercise-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exercise-block-head h4 {
  margin: 0;
}

.exercise-block-head .delete-button {
  min-height: 34px;
  padding: 0 14px;
}

.sentence-highlight {
  border: 0;
  border-radius: 8px;
  padding: 0 3px;
  color: #26305f;
  background: rgba(255, 229, 153, 0.72);
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
}

.sentence-highlight:hover {
  background: rgba(255, 214, 230, 0.86);
}

.diff-del {
  color: #b44268;
  background: rgba(255, 214, 230, 0.72);
  text-decoration: line-through;
  border-radius: 6px;
  padding: 1px 4px;
}

.diff-add {
  color: #247057;
  background: rgba(203, 247, 231, 0.82);
  border-radius: 6px;
  padding: 1px 4px;
}

.target-expression {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(238, 242, 255, 0.78);
  color: var(--soft-ink);
}

.target-expression.missed {
  color: #a13f57;
  background: rgba(255, 225, 236, 0.78);
}

.topic-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.topic-groups span {
  color: var(--muted);
  font-size: 0.86rem;
}

.related-save-popover {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 28px rgba(62, 57, 122, 0.1);
}

.related-save-popover strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.translation-panel,
.library-section {
  margin-top: 26px;
}

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

.level-card {
  display: grid;
  gap: 12px;
  min-height: 150px;
  padding: 18px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(139, 124, 255, 0.16);
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(62, 57, 122, 0.06);
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.native-expression-card {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(238, 242, 255, 0.68)),
    rgba(255, 255, 255, 0.58);
  box-shadow: 0 18px 42px rgba(62, 57, 122, 0.08);
}

.native-expression-card div {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.native-expression-card span {
  color: #6e63dd;
  font-size: 0.78rem;
  font-weight: 740;
  text-transform: uppercase;
}

.native-expression-card strong {
  color: var(--muted);
  font-size: 0.9rem;
}

.native-expression-card p {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.72;
}

.native-expression-card small {
  color: var(--muted);
  line-height: 1.65;
}

.level-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(62, 57, 122, 0.11);
}

.level-card.active {
  border-color: rgba(91, 91, 214, 0.36);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 22px 48px rgba(91, 91, 214, 0.14);
}

.level-card span {
  color: #6e63dd;
  font-size: 0.8rem;
  font-weight: 720;
}

.level-card strong {
  line-height: 1.6;
  font-weight: 620;
}

.level-card em,
.level-card small {
  color: var(--muted);
  font-style: normal;
  line-height: 1.62;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  margin-top: 26px;
}

.bottom-tools {
  align-items: start;
}

.panel {
  min-height: 350px;
  padding: 24px;
  animation: fadeUp 360ms var(--ease) both;
}

.panel-header {
  margin-bottom: 20px;
}

.stack {
  display: grid;
  gap: 16px;
}

.empty {
  min-height: 230px;
  display: grid;
  place-items: center;
  padding: 26px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  border: 1px dashed rgba(139, 124, 255, 0.25);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.38);
}

.expression-card,
.library-item,
.node-detail {
  padding: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(139, 124, 255, 0.14);
  border-radius: 24px;
  box-shadow: 0 14px 32px rgba(62, 57, 122, 0.07);
  animation: fadeUp 280ms var(--ease) both;
}

.expression-card {
  position: relative;
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease),
    border-color 180ms var(--ease),
    background 180ms var(--ease);
}

.expression-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 124, 255, 0.32);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 24px 48px rgba(62, 57, 122, 0.12);
}

.expression-card.selected {
  border-color: rgba(91, 91, 214, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(246, 243, 255, 0.72));
  box-shadow: 0 24px 52px rgba(91, 91, 214, 0.16);
}

.expression-card.rediscovered {
  border-color: rgba(139, 124, 255, 0.32);
}

.expression-card h3,
.library-item h3,
.node-detail h3 {
  margin-bottom: 6px;
  font-size: 1.14rem;
  font-weight: 680;
}

.meta,
.library-item small,
.detail-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.zh-meaning {
  margin: 14px 0 0;
  color: #555a73;
  line-height: 1.65;
}

.rediscovery-badge {
  position: absolute;
  top: 16px;
  right: 96px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  color: #5b5bd6;
  background: rgba(217, 204, 255, 0.6);
  font-size: 0.74rem;
  font-weight: 650;
}

.saved-note {
  margin-top: 12px;
  padding: 10px 12px;
  color: #5b5bd6;
  background: rgba(238, 242, 255, 0.72);
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 560;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.chip {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  color: #4f5bb8;
  background: rgba(238, 242, 255, 0.86);
  font-size: 0.78rem;
  font-weight: 620;
}

.chip.register {
  color: #6d5bc7;
  background: rgba(217, 204, 255, 0.52);
}

.alternatives,
.example-box {
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.alternatives b,
.example-box b {
  color: var(--soft-ink);
  font-weight: 650;
}

.example-box {
  padding: 14px;
  background: rgba(246, 243, 255, 0.66);
  border-radius: 18px;
}

.example-box span,
blockquote span {
  display: block;
  margin-top: 7px;
  color: #7d718a;
}

.network {
  position: relative;
  min-height: 230px;
}

.network:not(.empty) {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
  padding: 4px;
  border: 0;
}

.network:not(.empty)::before {
  content: "";
  position: absolute;
  inset: 28px 22px auto 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 124, 255, 0.24), transparent);
}

.node {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 999px;
  padding: 0 16px;
  color: #555a73;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 620;
  box-shadow: 0 12px 26px rgba(62, 57, 122, 0.08);
  transition:
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease),
    border-color 180ms var(--ease);
}

.node::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 1px;
  height: 10px;
  background: linear-gradient(rgba(139, 124, 255, 0.2), transparent);
}

.node:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 124, 255, 0.36);
  box-shadow: 0 18px 36px rgba(62, 57, 122, 0.11);
}

.node.related {
  color: #555a73;
}

.node.parent {
  color: #4f46c8;
  background: rgba(217, 204, 255, 0.5);
  border-color: rgba(139, 124, 255, 0.28);
}

.node.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #b8abff, #5b5bd6);
  box-shadow: 0 18px 38px rgba(91, 91, 214, 0.22);
}

.node-detail {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

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

.detail-head h3 {
  margin: 0;
}

.phrase-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.inline-word {
  border: 0;
  border-radius: 10px;
  padding: 4px 6px;
  color: var(--ink);
  background: transparent;
  font-weight: 680;
}

.inline-word:hover,
.inline-word.active {
  color: #3f37b8;
  background: rgba(217, 204, 255, 0.44);
}

.word-popover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0 14px;
  padding: 14px;
  background: rgba(246, 243, 255, 0.72);
  border: 1px solid rgba(139, 124, 255, 0.18);
  border-radius: 20px;
}

.word-popover strong,
.word-popover span,
.word-popover small {
  display: block;
}

.word-popover span {
  margin-top: 4px;
  color: var(--soft-ink);
  font-weight: 620;
}

.word-popover small {
  margin-top: 5px;
  color: var(--muted);
}

.node-detail p,
.library-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

blockquote {
  margin: 14px 0 0;
  padding: 14px;
  color: #4a506a;
  background: rgba(255, 255, 255, 0.66);
  border-left: 4px solid rgba(139, 124, 255, 0.42);
  border-radius: 18px;
  line-height: 1.65;
}

.library-item-head,
.history-item-head,
.vocab-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.library-related,
.word-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.word-chip {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 11px;
  color: #385e5a;
  background: rgba(216, 250, 244, 0.8);
  font-weight: 620;
}

.word-chip.active {
  color: white;
  background: linear-gradient(135deg, #b8abff, #5b5bd6);
}

.history-item {
  cursor: pointer;
}

.history-item-copy {
  min-width: 0;
}

.history-item-copy h3,
.history-item-copy p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.history-item-copy h3 {
  -webkit-line-clamp: 1;
}

.history-item-copy p {
  -webkit-line-clamp: 3;
}

.history-item-copy small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  color: #5b5bd6;
  background: rgba(238, 242, 255, 0.86);
  font-size: 0.78rem;
  font-weight: 700;
}

.history-item p,
.vocab-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}


.quick-lookup-dock {
  position: absolute;
  right: 18px;
  top: 42%;
  z-index: 45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.quick-lookup-toggle,
.quick-lookup-panel {
  pointer-events: auto;
}

.quick-lookup-dock.dragging {
  user-select: none;
}

.quick-lookup-toggle {
  min-width: 46px;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  padding: 10px 8px;
  color: white;
  background: linear-gradient(135deg, #9c8dff, #5b5bd6);
  box-shadow: 0 18px 44px rgba(62, 57, 122, 0.18);
  font-weight: 760;
  writing-mode: vertical-rl;
  letter-spacing: 0;
  touch-action: none;
  cursor: grab;
}

.quick-lookup-dock.dragging .quick-lookup-toggle {
  cursor: grabbing;
}

.quick-lookup-panel {
  width: min(360px, calc(100vw - 92px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 24px 70px rgba(62, 57, 122, 0.18);
  backdrop-filter: blur(24px) saturate(1.15);
  transition:
    opacity 180ms var(--ease),
    transform 180ms var(--ease),
    visibility 180ms var(--ease);
}

.quick-lookup-dock.collapsed .quick-lookup-panel {
  visibility: hidden;
  opacity: 0;
  transform: translateX(16px) scale(0.98);
}

.quick-lookup-head,
.quick-lookup-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-lookup-head h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.quick-lookup-form {
  margin-top: 14px;
}

.quick-lookup-form input {
  min-width: 0;
  flex: 1;
  min-height: 44px;
  border: 1px solid rgba(120, 111, 190, 0.16);
  border-radius: 999px;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: 0;
}

.quick-lookup-form input:focus {
  border-color: rgba(91, 91, 214, 0.34);
  box-shadow: 0 0 0 6px rgba(139, 124, 255, 0.12);
}

.quick-lookup-form .primary-button {
  min-height: 44px;
  padding: 0 17px;
}

.quick-lookup-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.quick-lookup-meta,
.quick-lookup-loading {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-lookup-item {
  user-select: text;
  width: 100%;
  border: 1px solid rgba(120, 111, 190, 0.14);
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--ink);
  background: rgba(246, 243, 255, 0.66);
  text-align: left;
}

.quick-lookup-item:hover {
  border-color: rgba(91, 91, 214, 0.24);
  background: rgba(238, 242, 255, 0.82);
}

.quick-lookup-item strong,
.quick-lookup-item span,
.quick-lookup-item small {
  display: block;
}

.quick-lookup-item strong {
  font-size: 0.96rem;
}

.quick-lookup-item span {
  margin-top: 4px;
  color: var(--soft-ink);
  font-weight: 620;
}

.quick-lookup-item small {
  margin-top: 4px;
  color: var(--muted);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .app-shell {
    width: min(100% - 28px, 1540px);
    padding-top: 18px;
  }

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

  .sidebar {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar,
  .toolbar,
  .section-title,
  .library-item-head,
  .history-item-head,
  .vocab-item-head,
  .word-popover,
  .grid,
  .level-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .account-strip {
    justify-content: flex-start;
  }

  .account-panel {
    align-items: flex-start;
  }

  .brand-lockup img {
    width: min(260px, 82vw);
  }

  .brand-area {
    display: grid;
    align-items: flex-start;
    gap: 14px;
  }

  .brand-slogan {
    max-width: 100%;
    font-size: 0.96rem;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

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