:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f4f8;
  --line: #e3eaf5;
  --line-strong: #d1dbea;
  --text: #152033;
  --muted: #647086;
  --faint: #97a2b3;
  --green: #3d6fa8;
  --green-dark: #2f5f93;
  --green-soft: #eef5fb;
  --highlight: #e3effa;
  --row-active: #f1f6fb;
  --shadow: none;
  --shadow-soft: none;
  --table-head-bg: rgba(248, 250, 255, 0.98);
  --page-gutter: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(680px, 1.15fr) minmax(500px, 0.85fr);
  grid-template-rows: 104px minmax(0, 1fr);
  column-gap: 0;
  row-gap: 0;
  justify-content: stretch;
  height: 100vh;
  min-height: 720px;
  padding: 0 var(--page-gutter);
}

.topbar {
  position: static;
  z-index: 20;
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  min-width: 0;
  height: 104px;
  padding: 0 24px;
  width: auto;
  margin-inline: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.module-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  min-width: 0;
  border-bottom: 0;
  background: transparent;
}

.module-tab {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #5f6b80;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 760;
}

.module-tab:hover {
  background: #f5f8fc;
}

.module-tab.active {
  border-color: #cdd9ea;
  color: var(--text);
  background: #f8fbff;
}

.module-tab.disabled {
  color: #a1aabb;
  cursor: default;
}

.module-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--green-dark);
  background: #e7f0fb;
  font-size: 12px;
  font-weight: 820;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--table-head-bg);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  width: 220px;
  padding: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
}

.brand h1,
.pane-header h2,
.detail-title h2,
.detail-title p,
.filter-section h2,
.empty-state h2,
.empty-state p {
  margin: 0;
}

.brand h1 {
  color: #26312d;
  font-family:
    "Georgia", "Times New Roman", "Songti SC", serif;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.filter-section {
  padding: 22px 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-section h2 {
  padding: 0 8px 10px;
  color: #64736e;
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.choice-list {
  display: grid;
  gap: 4px;
}

.choice {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  width: 100%;
  padding: 0 12px;
  border-radius: 10px;
  color: #33413b;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.choice-label {
  min-width: 0;
}

.choice-count {
  margin-left: auto;
  color: var(--faint);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.choice:hover {
  background: #f1f6ff;
}

.choice.active {
  color: var(--green-dark);
  background: #dbeafe;
  box-shadow: none;
}

.choice.disabled {
  color: var(--faint);
  cursor: default;
}

.choice.disabled:hover {
  background: transparent;
}

.workspace {
  display: contents;
}

.table-pane,
.detail-pane {
  grid-row: 2;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-pane {
  grid-column: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.pane-header h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 820;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 15px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--table-head-bg);
  color: #5f6b80;
  text-align: left;
  font-size: 12px;
  font-weight: 760;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover td {
  background: #f7faff;
}

tbody tr.active td {
  background: var(--row-active);
}

tbody tr.active td:first-child {
  box-shadow: inset 4px 0 0 var(--green);
}

td {
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-col {
  width: 82px;
}

tbody td:first-child {
  width: 82px;
  color: var(--faint);
  font-weight: 400;
}

.doc-col {
  width: 86px;
  text-align: right;
}

.freq-col {
  width: 92px;
  text-align: right;
}

.term-cell,
thead th:nth-child(2) {
  width: 250px;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  width: auto;
}

.term-cell {
  color: var(--green-dark);
  font-weight: 780;
  line-height: 1.35;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.term-cell span {
  display: inline;
}

.freq {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  font-weight: 400;
}

.doc-count {
  color: var(--faint);
  font-weight: 400;
}

.detail-pane {
  grid-column: 3;
  min-height: 0;
  border-right: 0;
}

.detail-content {
  height: 100%;
  overflow: auto;
}

.detail-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 22px 24px 8px;
  border-bottom: 0;
  background: #fff;
}

.detail-title {
  display: grid;
  gap: 8px;
}

.detail-title h2 {
  color: #26312d;
  font-family:
    "Georgia", "Times New Roman", "Songti SC", serif;
  font-size: 36px;
  line-height: 1.08;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.phonetic-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2px 0 0;
  color: var(--faint);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.audio-button {
  appearance: none;
  border: 1px solid #d8e2ee;
  border-radius: 999px;
  background: #f7fafd;
  color: #2f5f97;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  padding: 7px 11px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.audio-button:hover,
.audio-button.playing {
  border-color: #b9cee6;
  background: #eaf3ff;
  color: #214f82;
}

.detail-title p {
  color: #303b36;
  font-size: 16px;
  line-height: 1.5;
}

.definition-block {
  padding: 4px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.definition-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 780;
}

.definition-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #303b36;
  font-size: 14px;
  line-height: 1.6;
}

.definition-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.definition-item.plain {
  display: block;
}

.pos-tag {
  color: var(--faint);
  font-weight: 500;
  white-space: nowrap;
}

.examples-block {
  padding: 20px 0 28px;
}

.examples-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px 12px;
}

.examples-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 780;
}

.examples-title span {
  color: var(--muted);
  font-size: 12px;
}

.example-list {
  display: grid;
}

.example {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}

.example:last-child {
  border-bottom: 1px solid var(--line);
}

.example-number {
  padding-top: 4px;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.example-text {
  margin: 0;
  max-width: 68ch;
  color: #26312d;
  font-family:
    "Georgia", "Times New Roman", "Songti SC", serif;
  font-size: 15px;
  line-height: 1.66;
}

.example-source {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.4;
}

mark {
  padding: 0 2px;
  border-radius: 5px;
  background: var(--highlight);
  color: inherit;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 100%;
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  color: var(--text);
  font-size: 24px;
}

.empty-state p {
  max-width: 360px;
  margin-top: 10px;
  line-height: 1.7;
}

.loading-row td,
.error-row td {
  height: 120px;
  color: var(--muted);
  text-align: center;
}
