:root {
  color-scheme: light;
  --brand: #cf4b45;
  --brand-dark: #b43f3a;
  --brand-soft: #fff0ef;
  --brand-pale: #fff3f1;
  --ink: #333942;
  --muted: #737985;
  --soft-text: #969ba4;
  --line: #e8e5e3;
  --surface: #ffffff;
  --page: #f7f5f3;
  --success: #4d7d62;
  --warning: #a56b2c;
  --shadow: 0 16px 42px rgba(75, 55, 48, 0.08);
  --control-height: 44px;
  --control-radius: 12px;
  --control-border: #e8e5e3;
  --focus-ring: 0 0 0 3px rgba(207, 75, 69, 0.12);
  --reading-font: "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(207, 75, 69, 0.07), transparent 28rem),
    var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(207, 75, 69, 0.22);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.g_card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 16px;
}

.g_form_group {
  display: grid;
  gap: 8px;
}

.g_label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}

.g_input,
.g_select,
.g_textarea,
.g_button {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-height);
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 16px;
}

.g_input,
.g_select {
  padding: 0 14px;
}

.g_select {
  padding-right: 44px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737985' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

.g_textarea {
  min-height: 88px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

.g_button {
  display: inline-flex;
  width: auto;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 550;
  white-space: nowrap;
}

.g_btn_primary {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.g_btn_secondary {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.25);
}

.g_input:focus-visible,
.g_select:focus-visible,
.g_textarea:focus-visible,
.g_button:focus-visible {
  border-color: var(--brand);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.g_input:disabled,
.g_select:disabled,
.g_textarea:disabled,
.g_button:disabled {
  color: var(--soft-text);
  background: #f0ecea;
  border-color: var(--control-border);
  cursor: not-allowed;
  opacity: 1;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 248px;
  padding: 24px 18px 20px;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid rgba(232, 229, 227, 0.9);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  font-weight: 550;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  margin-top: 34px;
  flex-direction: column;
  gap: 6px;
}

.top-nav a,
.top-nav button {
  display: flex;
  min-height: 46px;
  padding: 0 14px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.top-nav button > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--soft-text);
}

.top-nav button > span svg {
  display: block;
  width: 20px;
  height: 20px;
}

.top-nav a.active,
.top-nav button.active {
  color: var(--brand);
  font-weight: 550;
  background: var(--brand-pale);
}

.top-nav button.active > span {
  color: var(--brand);
}

.miniapp-sidebar-card {
  display: grid;
  width: 180px;
  margin: auto auto 0;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.miniapp-sidebar-card img {
  display: block;
  width: 168px;
  height: 168px;
  padding: 8px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid rgba(207, 75, 69, 0.16);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(75, 55, 48, 0.08);
}

.miniapp-sidebar-card strong,
.miniapp-sidebar-card small {
  display: block;
  line-height: 1.4;
}

.miniapp-sidebar-card strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 550;
}

.miniapp-sidebar-card small {
  color: var(--muted);
  font-size: 16px;
}

.miniapp-sidebar-card + .header-actions {
  margin-top: 18px;
}

.model-chip {
  display: inline-flex;
  width: max-content;
  min-height: 36px;
  margin-left: auto;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  background: #faf9f8;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.header-actions {
  display: flex;
  margin-top: auto;
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
}

.sidebar-toggle {
  display: none;
}

.member-area {
  position: relative;
}

.member-button {
  display: inline-flex;
  min-height: 52px;
  max-width: 238px;
  padding: 4px 10px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: left;
}

.member-button:hover,
.member-button:focus-visible {
  background: transparent;
}

.member-button img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.member-profile-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.member-more {
  width: 18px;
  height: 18px;
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--muted);
}

.member-profile-text strong {
  max-width: 176px;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-profile-text time,
.member-profile-text > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.member-live-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-live-line > span::before {
  margin-right: 6px;
  color: var(--line-strong);
  content: "·";
}

.member-menu {
  position: absolute;
  bottom: 0;
  left: calc(100% + 12px);
  z-index: 80;
  width: 280px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(51, 57, 66, 0.16);
}

.member-menu-profile {
  display: flex;
  min-height: 64px;
  padding: 8px 10px;
  align-items: center;
  gap: 12px;
}

.member-menu-profile img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
}

.member-menu-profile > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.member-menu-name-link {
  width: max-content;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}

.member-menu-id-line {
  display: flex;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  gap: 4px;
}

.member-id-copy-button {
  display: inline-flex;
  width: 36px;
  height: 36px;
  padding: 0;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.member-id-copy-button:hover,
.member-id-copy-button:focus-visible {
  color: var(--brand);
  background: transparent;
}

.member-id-copy-button svg {
  width: 17px;
  height: 17px;
}

.member-menu-profile strong,
.member-menu-profile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-menu-profile strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 550;
}

.member-menu-profile small {
  color: var(--muted);
  font-size: 13px;
}

.member-menu-divider {
  height: 1px;
  margin: 5px -8px;
  background: var(--line);
}

.member-menu-item,
.logout-button {
  display: flex;
  position: static;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 9px;
  box-shadow: none;
}

.member-menu-item:hover,
.member-menu-item:focus-visible,
.logout-button:hover,
.logout-button:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
}

.member-menu-item svg,
.logout-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.account-records-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 30px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(51, 57, 66, 0.2);
}

.account-records-dialog h2 {
  margin: 6px 0 8px;
  font-size: clamp(26px, 3vw, 36px);
}

.account-records-dialog > p {
  margin: 0 48px 20px 0;
  color: var(--muted);
}

.account-records-summary {
  margin-bottom: 14px;
  padding: 13px 16px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.account-records-list {
  display: grid;
  gap: 10px;
  max-height: min(520px, calc(100vh - 250px));
  overflow: auto;
}

.account-record-row {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) minmax(220px, 2fr) minmax(110px, .9fr) minmax(110px, .8fr);
  min-height: 66px;
  padding: 12px 14px;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.account-record-row.account-record-heading {
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
}

.account-record-main {
  min-width: 0;
}

.account-record-main strong,
.account-record-main small {
  display: block;
}

.account-record-main strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-record-main small,
.account-record-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.account-record-amount {
  color: var(--brand);
  font-weight: 550;
  text-align: right;
}

.account-record-empty {
  padding: 52px 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

.account-load-more {
  width: 100%;
  margin-top: 14px;
}

.auth-gate {
  display: grid;
  min-height: calc(100vh - 72px);
  padding: 32px 16px;
  place-items: center;
}

.auth-card {
  width: min(100%, 440px);
  padding: 38px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  object-fit: contain;
}

.auth-card h1 {
  margin: 12px 0 12px;
  font-size: 28px;
  font-weight: 550;
}

.auth-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.auth-method-tabs {
  display: grid;
  margin-top: 24px;
  padding: 4px;
  grid-template-columns: 1fr 1fr;
  background: #f2efed;
  border-radius: 10px;
}

.auth-method-tabs button {
  min-height: 40px;
  color: var(--muted);
  font-size: 14px;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.auth-method-tabs button.active {
  color: var(--brand);
  background: #fff;
  box-shadow: 0 3px 10px rgba(75, 55, 48, 0.06);
}

.auth-method-panel {
  margin-top: 2px;
}

.auth-qr-wrap {
  display: grid;
  width: 236px;
  height: 236px;
  margin: 24px auto 14px;
  padding: 12px;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.auth-qr-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-qr-loading {
  color: var(--muted);
  font-size: 13px;
}

.auth-status {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}

.auth-refresh {
  margin-top: 12px;
}

.email-login {
  padding-top: 16px;
  text-align: left;
}

.email-login label {
  display: block;
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
}

.email-login input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #dcd9d7;
  border-radius: 9px;
}

.email-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 9px;
}

.email-code-row button {
  color: var(--brand);
  font-size: 13px;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.24);
  border-radius: 9px;
}

.email-code-row button:disabled {
  color: var(--soft-text);
  cursor: wait;
}

.email-login-btn {
  margin-top: 20px;
}

.email-login-status {
  display: block;
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.email-login-status.binding-required {
  padding: 10px 12px;
  color: var(--brand);
  background: var(--brand-pale);
  border-radius: 8px;
  text-align: left;
}

.email-bind-panel {
  margin-top: 18px;
  padding: 20px;
  text-align: center;
  background: #fff7f5;
  border: 1px solid #f1d0cb;
  border-radius: 18px;
}

.email-bind-panel > strong,
.email-bind-panel > p,
.email-bind-status {
  display: block;
}

.email-bind-panel > strong {
  color: #333942;
  font-size: 18px;
}

.email-bind-panel > p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.email-bind-qr-wrap {
  margin: 16px auto 12px;
  background: #fff;
}

.email-bind-status {
  color: var(--brand);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #b9b9bd;
  border-radius: 50%;
}

.status-dot.loading {
  background: #d59b4f;
  box-shadow: 0 0 0 4px rgba(213, 155, 79, 0.14);
}

.status-dot.ready {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(77, 125, 98, 0.12);
}

.status-dot.error {
  background: var(--brand);
}

main {
  width: calc(100% - 248px);
  min-height: 100vh;
  margin-left: 248px;
}

.welcome {
  display: grid;
  min-height: calc(100vh - 72px);
  padding: 64px clamp(24px, 5vw, 84px);
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 0.75fr);
  align-items: center;
  gap: clamp(48px, 7vw, 110px);
}

.welcome-copy {
  max-width: 680px;
}

.eyebrow,
.section-kicker {
  color: var(--brand);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.08em;
}

.welcome h1 {
  max-width: 650px;
  margin: 18px 0 24px;
  font-size: clamp(38px, 5vw, 68px);
  font-weight: 550;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.welcome-copy > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
}

.privacy-note {
  display: inline-flex;
  margin-top: 28px;
  padding: 10px 14px;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-size: 14px;
  background: rgba(77, 125, 98, 0.08);
  border-radius: 8px;
}

.import-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.import-tabs {
  display: grid;
  padding: 8px;
  grid-template-columns: 1fr 1fr;
  background: #f2efed;
}

.import-tabs.three {
  grid-template-columns: repeat(3, 1fr);
}

.import-tabs.four {
  grid-template-columns: repeat(4, 1fr);
}

.tab {
  min-height: 46px;
  color: var(--muted);
  font-weight: 550;
  background: transparent;
  border: 0;
  border-radius: 12px;
}

.tab.active {
  color: var(--brand);
  background: #fff;
  box-shadow: 0 4px 12px rgba(75, 55, 48, 0.06);
}

.import-panel {
  padding: 26px;
}

.import-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.drop-zone {
  display: flex;
  min-height: 220px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  background: var(--brand-pale);
  border: 1px dashed #d9b8b3;
  border-radius: 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.drop-zone strong {
  font-size: 18px;
  font-weight: 550;
}

.drop-zone > span:not(.drop-icon),
.drop-zone small {
  color: var(--muted);
}

.drop-zone small {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
}

.drop-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 6px;
  place-items: center;
  color: #fff;
  font-size: 24px;
  background: var(--brand);
  border-radius: 50%;
}

.drop-icon.video {
  padding-left: 3px;
  font-size: 20px;
}

.book-file {
  display: flex;
  min-height: 66px;
  margin-top: 14px;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 550;
  background: var(--brand-pale);
  border: 1px dashed #d9b8b3;
  border-radius: 10px;
  cursor: pointer;
}

.book-file small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.selected-file {
  display: flex;
  margin-top: 12px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  background: #f7f7f7;
  border-radius: 8px;
}

.selected-file button,
.text-btn {
  color: var(--brand);
  background: transparent;
  border: 0;
}

.field-label,
.practice-card label {
  display: block;
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 550;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  line-height: 1.65;
  background: #fff;
  border: 1px solid #dcd9d7;
  border-radius: 10px;
  resize: vertical;
}

input[type="text"] {
  min-height: 48px;
}

textarea::placeholder,
input::placeholder {
  color: #aaa7a6;
}

.primary-btn {
  display: inline-flex;
  width: 100%;
  min-height: 50px;
  margin-top: 20px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 550;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary-btn.compact {
  width: auto;
  min-height: 42px;
  margin: 0;
}

.secondary-btn {
  display: inline-flex;
  min-height: 46px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-weight: 550;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.25);
  border-radius: 11px;
}

.secondary-btn.compact {
  min-height: 38px;
  padding: 0 15px;
  font-size: 14px;
}

.library-view {
  width: min(1480px, calc(100% - 48px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 46px 0 72px;
}

.portal-view {
  width: min(1180px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0 72px;
}

#toolsView {
  width: calc(100% - 48px);
  margin-left: 24px;
  margin-right: auto;
}

.image-reader-host-view,
.speaking-conversation-host-view,
.mindmap-video-host-view {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.tool-host-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  background: var(--page);
  border: 0;
}

.image-reader-frame,
.speaking-conversation-frame,
.mindmap-video-frame {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--page);
  border: 0;
}

.portal-heading {
  margin-bottom: 28px;
}

.portal-heading h1 {
  margin: 9px 0 8px;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 550;
  letter-spacing: -0.03em;
}

.portal-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.review-summary,
.review-deck {
  padding: 24px;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.review-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.review-summary h2 {
  margin: 6px 0;
  font-size: 22px;
}

.review-summary h2 strong {
  color: var(--brand);
}

.review-summary p,
.review-card span,
.review-deck-meta {
  color: var(--muted);
}

.review-deck-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.review-summary-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.review-summary-button {
  width: 124px;
  min-height: 46px;
}

.review-summary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.review-deck-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.review-card {
  min-height: 240px;
  padding: 38px 24px;
  margin-top: 16px;
  text-align: center;
  background: var(--brand-pale);
  border-radius: 16px;
}

.review-word-line {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.review-card h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 550;
  line-height: 1.35;
}

.review-phonetic {
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
}

.review-speak-btn {
  display: inline-flex;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: #fff;
  border: 1px solid rgba(207, 75, 69, 0.24);
  border-radius: 50%;
}

.review-speak-btn:hover {
  background: rgba(207, 75, 69, 0.05);
  border-color: var(--brand);
}

.review-speak-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.review-back {
  display: grid;
  padding-top: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
  border-top: 1px solid rgba(207, 75, 69, 0.16);
  gap: 8px;
}

.review-definition-row {
  display: grid;
  width: min(880px, 100%);
  margin: 0 auto;
  grid-template-columns: minmax(48px, auto) 1fr;
  align-items: start;
  gap: 14px;
  text-align: left;
}

.review-definition-row > span {
  color: var(--brand);
}

.review-definition-row p {
  margin: 0;
}

.review-key-hint {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.review-rating {
  display: grid;
  margin-top: 16px;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.review-rating button {
  display: flex;
  min-width: 0;
  min-height: 124px;
  padding: 14px 12px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.review-rating button:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(207, 75, 69, 0.035);
}

.review-rating strong {
  font-size: 16px;
  font-weight: 550;
  line-height: 1.35;
}

.review-rating button > span {
  min-height: 40px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.review-rating small {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  color: var(--brand);
  font-size: 14px;
  line-height: 1.35;
  border-top: 1px solid rgba(207, 75, 69, 0.12);
}

.review-settings-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(42, 34, 31, 0.24);
}

.review-settings-dialog::backdrop {
  background: rgba(32, 27, 25, 0.48);
  backdrop-filter: blur(3px);
}

.review-settings-heading,
.review-settings-actions {
  display: flex;
  padding: 20px 24px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.review-settings-heading h2 {
  margin: 5px 0 0;
  font-size: 24px;
  font-weight: 550;
}

.review-settings-fields {
  display: grid;
  padding: 8px 24px;
}

.review-settings-fields > label {
  display: flex;
  min-height: 68px;
  margin: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.review-settings-fields > label > span:first-child {
  display: grid;
  gap: 4px;
}

.review-settings-fields > label > span:first-child strong {
  font-weight: 500;
}

.review-settings-fields > label > span:first-child small {
  color: var(--muted);
  line-height: 1.5;
}

.review-settings-fields select {
  width: 150px;
  min-height: 42px;
  margin: 0;
}

.review-settings-fields > label:last-child {
  border-bottom: 0;
}

.review-switch-row > span {
  display: grid;
  gap: 4px;
}

.review-switch-row strong {
  font-weight: 500;
}

.review-switch-row small {
  color: var(--muted);
  line-height: 1.5;
}

.review-switch-row input {
  width: 44px;
  height: 24px;
  margin: 0;
  accent-color: var(--brand);
}

.review-number-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-number-field input {
  width: 92px;
  min-height: 42px;
  margin: 0;
  text-align: center;
}

.review-number-field em {
  min-width: 20px;
  color: var(--muted);
  font-style: normal;
}

.review-settings-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.pronunciation-history-heading {
  display: flex;
  margin-top: 24px;
  padding-top: 18px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

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

.pronunciation-history > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pronunciation-history-item {
  display: grid;
  padding: 12px;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  background: #f8f6f5;
  border-radius: 10px;
}

.pronunciation-history-item > strong {
  color: var(--brand);
  font-size: 22px;
}

.pronunciation-history-item p,
.pronunciation-history-item small {
  margin: 0;
}

.pronunciation-history-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pronunciation-history-item small {
  color: var(--muted);
}

.ai-conversation-panel {
  padding: 26px;
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.ai-conversation-panel .ai-workbench-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.ai-chat-log {
  display: flex;
  min-height: 260px;
  max-height: 520px;
  margin-top: 20px;
  padding: 18px;
  overflow-y: auto;
  flex-direction: column;
  gap: 12px;
  background: #f8f6f5;
  border-radius: 14px;
}

.ai-chat-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.ai-chat-message {
  max-width: min(82%, 760px);
  padding: 12px 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  border-radius: 14px;
}

.ai-chat-message.user {
  align-self: flex-end;
  color: #fff;
  background: var(--brand);
  border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.ai-chat-message small {
  display: block;
  margin-bottom: 4px;
  opacity: 0.72;
}

.ai-chat-form > div {
  display: flex;
  margin-top: 10px;
  align-items: center;
  gap: 12px;
}

.ai-chat-form textarea {
  margin-top: 14px;
}

#aiChatStatus {
  color: var(--muted);
  font-size: 13px;
}

.subtitle-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(42, 34, 31, 0.24);
}

.subtitle-dialog::backdrop {
  background: rgba(32, 27, 25, 0.48);
  backdrop-filter: blur(3px);
}

.subtitle-dialog-heading,
.subtitle-editor-toolbar,
.subtitle-dialog-actions {
  display: flex;
  padding: 18px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.subtitle-dialog-heading h2 {
  margin: 5px 0 0;
}

.subtitle-file-preview-dialog {
  width: min(900px, calc(100vw - 32px));
}

.subtitle-file-preview-dialog pre {
  max-height: calc(100vh - 150px);
  padding: 20px 22px;
  margin: 0;
  overflow: auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.subtitle-editor-toolbar > div {
  display: flex;
  gap: 10px;
}

#subtitleEditorStatus {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

.subtitle-editor-list {
  display: grid;
  max-height: calc(100vh - 250px);
  padding: 18px 22px;
  overflow-y: auto;
  gap: 10px;
}

.subtitle-editor-row {
  display: grid;
  padding: 12px;
  grid-template-columns: 42px 100px 100px minmax(220px, 1fr) minmax(180px, 0.8fr) 42px;
  align-items: start;
  gap: 9px;
  background: #f8f6f5;
  border-radius: 12px;
}

.subtitle-editor-row input,
.subtitle-editor-row textarea {
  min-height: 42px;
  padding: 9px 10px;
  margin: 0;
  line-height: 1.5;
  resize: vertical;
}

.subtitle-editor-row > span {
  padding-top: 10px;
  color: var(--muted);
  text-align: center;
}

.subtitle-delete {
  min-height: 42px;
  color: var(--brand);
  background: transparent;
  border: 0;
}

.subtitle-dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.subtitle-dialog-actions .secondary-btn {
  min-height: 42px;
}

.baidu-netdisk-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(42, 34, 31, 0.24);
}

.baidu-netdisk-dialog::backdrop {
  background: rgba(32, 27, 25, 0.48);
  backdrop-filter: blur(3px);
}

.baidu-netdisk-heading,
.baidu-netdisk-account,
.baidu-netdisk-browser,
.baidu-netdisk-actions {
  padding: 16px 20px;
}

.baidu-netdisk-heading {
  padding-right: 64px;
  border-bottom: 1px solid var(--line);
}

.baidu-netdisk-heading h2 {
  margin: 5px 0 6px;
  font-size: 22px;
  font-weight: 550;
}

.baidu-netdisk-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.baidu-netdisk-guide {
  margin: 0;
  padding: 11px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  background: #fffaf2;
  border-bottom: 1px solid #eee0c8;
}

.baidu-netdisk-guide strong {
  color: var(--ink);
  font-weight: 550;
}

.baidu-netdisk-account,
.baidu-netdisk-actions,
.baidu-netdisk-toolbar,
.baidu-netdisk-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.baidu-netdisk-account {
  background: var(--brand-pale);
  border-bottom: 1px solid rgba(207, 75, 69, 0.16);
}

.baidu-netdisk-status-copy {
  min-width: 0;
  flex: 1;
}

.baidu-netdisk-status-copy > span,
.baidu-netdisk-status-copy > small {
  display: block;
}

.baidu-netdisk-status-copy > span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.baidu-netdisk-status-copy > small {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.baidu-netdisk-progress {
  width: min(520px, 100%);
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  background: #e8dfdc;
  border-radius: 999px;
}

.baidu-netdisk-progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  transition: width 180ms ease;
}

.baidu-netdisk-status-copy > span[data-mode="success"] {
  color: #3e7d61;
}

.baidu-netdisk-status-copy > span[data-mode="error"] {
  color: var(--brand);
}

.baidu-netdisk-account > div,
.baidu-netdisk-actions > div {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.baidu-netdisk-login-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.baidu-netdisk-login-actions .primary-btn,
.baidu-netdisk-login-actions .secondary-btn {
  width: auto;
  margin: 0;
}

.baidu-netdisk-browser {
  padding-bottom: 8px;
}

.baidu-netdisk-toolbar code {
  min-width: 0;
  padding: 7px 10px;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f6f3f1;
  border-radius: 9px;
}

.baidu-netdisk-file-list {
  display: grid;
  min-height: 220px;
  max-height: min(420px, calc(100vh - 390px));
  margin: 14px 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.baidu-netdisk-file {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.baidu-netdisk-file:last-child {
  border-bottom: 0;
}

.baidu-netdisk-folder,
.baidu-netdisk-file-choice {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  padding: 10px 14px;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.baidu-netdisk-folder:hover,
.baidu-netdisk-file-choice:hover {
  background: #faf8f7;
}

.baidu-netdisk-folder > span {
  color: var(--brand);
}

.baidu-netdisk-file-choice input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand);
}

.baidu-netdisk-file-choice > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.baidu-netdisk-folder strong,
.baidu-netdisk-file-choice strong {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.baidu-netdisk-file-choice small {
  color: var(--muted);
}

.baidu-netdisk-empty {
  margin: auto;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.baidu-netdisk-actions {
  border-top: 1px solid var(--line);
}

.baidu-netdisk-actions > span {
  color: var(--muted);
}

@media (max-width: 640px) {
  .baidu-netdisk-account,
  .baidu-netdisk-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .baidu-netdisk-account > div,
  .baidu-netdisk-actions > div {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .baidu-netdisk-account .primary-btn {
    grid-column: 1 / -1;
  }

  .baidu-netdisk-login-actions .primary-btn,
  .baidu-netdisk-login-actions .secondary-btn {
    width: 100%;
  }

  .baidu-netdisk-file-list {
    max-height: calc(100vh - 470px);
  }
}

.learning-dashboard {
  display: grid;
  margin-bottom: 28px;
  gap: 18px;
}

.learning-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.learning-stat-grid article,
.learning-dashboard-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.learning-stat-grid article {
  display: grid;
  padding: 18px;
  gap: 8px;
}

.learning-stat-grid span,
.dashboard-card-heading > span,
#notesCenterStatus {
  color: var(--muted);
  font-size: 13px;
}

.learning-stat-grid strong {
  font-size: 25px;
}

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

.learning-dashboard-card {
  padding: 20px;
}

.learning-section-tabs {
  width: 100%;
  margin: 0;
}

.learning-section-tabs button {
  flex: 1;
}

.learning-section-panel[hidden] {
  display: none;
}

.learning-record-toolbar {
  display: flex;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-category-controls,
.record-category-create {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-category-create[hidden] {
  display: none;
}

.record-category-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.record-category-filter select,
.record-category-create input {
  min-height: 38px;
  margin: 0;
  padding: 0 14px;
  color: var(--text);
  font-size: 14px;
  background-color: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.25);
  border-radius: 11px;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.record-category-filter select {
  min-width: 170px;
  padding-right: 38px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cf4b45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.record-category-create input {
  width: 190px;
  background-color: var(--surface);
}

.record-category-filter select:hover,
.record-category-create input:hover {
  border-color: rgba(207, 75, 69, 0.45);
}

.record-category-filter select:focus-visible,
.record-category-create input:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.1);
}

.learning-record-toolbar .record-tabs {
  flex: none;
  margin: 0 0 0 auto;
}

.dashboard-card-heading {
  display: flex;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-card-heading h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.study-week-chart {
  display: grid;
  min-height: 170px;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
}

.study-week-day {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 7px;
}

.study-week-day strong,
.study-week-day small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.study-week-day > span {
  position: relative;
  display: flex;
  width: min(32px, 80%);
  height: 105px;
  align-items: flex-end;
  overflow: hidden;
  background: #f1edeb;
  border-radius: 8px;
}

.study-week-day i {
  display: block;
  width: 100%;
  min-height: 3px;
  background: var(--brand);
  border-radius: 8px;
}

.desktop-install-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

#desktopInstallStatus {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.notes-center-list {
  display: grid;
  margin-top: 14px;
  gap: 8px;
}
.dashboard-empty {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-empty {
  padding: 18px 0;
  margin: 0;
  text-align: center;
}

.notes-center-list {
  min-height: 120px;
}

.notes-center-item button {
  display: grid;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  gap: 5px;
  background: #f8f6f5;
  border: 0;
  border-radius: 11px;
}

.notes-center-item span {
  line-height: 1.65;
}

.notes-center-item small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-center-tabs {
  width: max-content;
  margin: 0 0 0 auto;
}

.notes-center-toolbar {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notes-center-pagination {
  display: flex;
  margin-top: 14px;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.notes-center-pagination[hidden] {
  display: none;
}

#notesPageStatus,
.material-summary-meta,
.material-summary-detail-heading span {
  color: var(--muted);
  font-size: 13px;
}

.material-summary-list {
  display: grid;
  gap: 12px;
}

.material-summary-list[hidden] {
  display: none;
}

.material-summary-card {
  overflow: hidden;
  background: #f8f6f5;
  border-radius: 12px;
}

.material-summary-open {
  display: flex;
  width: 100%;
  min-height: 78px;
  padding: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: inherit;
}

.material-summary-open:hover,
.material-summary-open:focus-visible {
  background: var(--brand-pale);
}

.material-summary-open > span:first-child {
  display: grid;
  gap: 5px;
}

.material-summary-action {
  color: var(--brand);
  white-space: nowrap;
}

.material-summary-detail {
  display: grid;
  gap: 14px;
}

.material-summary-detail[hidden] {
  display: none;
}

.material-summary-detail-heading {
  display: grid;
  gap: 10px;
}

.material-summary-detail-heading > div {
  display: grid;
  gap: 5px;
}

.material-summary-detail-heading h3 {
  margin: 0;
}

.material-summary-note-list {
  display: grid;
  gap: 10px;
}

.material-summary-note {
  display: grid;
  width: 100%;
  padding: 14px 16px;
  gap: 7px;
  color: var(--text);
  text-align: left;
  background: #f8f6f5;
  border: 0;
  border-radius: 11px;
}

.material-summary-note:hover,
.material-summary-note:focus-visible {
  background: var(--brand-pale);
}

.material-summary-note strong {
  color: var(--brand);
}

.material-summary-note span {
  line-height: 1.65;
}

.material-summary-note small {
  color: var(--muted);
  line-height: 1.55;
}

.sentence-item.note-located {
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.42);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.08);
}

.material-category-select {
  max-width: 180px;
  padding: 0 30px 0 10px;
  font-size: 13px;
}

.corpus-title-line {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.corpus-title-line h1 {
  margin: 0;
}

.corpus-sync-control {
  display: flex;
  align-items: center;
  padding-top: 8px;
}

.corpus-sync-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.corpus-sync-button:hover,
.corpus-sync-button:focus-visible {
  color: var(--brand);
  background: transparent;
  border-color: transparent;
  outline: none;
}

.corpus-sync-button:active {
  transform: scale(0.92);
}

.corpus-sync-button.is-success {
  color: #2f9b73;
}

.corpus-sync-button.is-error {
  color: var(--brand);
}

.corpus-sync-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.corpus-sync-button svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.corpus-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.corpus-overview button {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 108px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.corpus-overview button strong {
  color: var(--ink);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 550;
  line-height: 1.1;
}

.corpus-overview button span {
  margin-top: 6px;
  color: inherit;
  font-size: 15px;
}


.corpus-list {
  display: grid;
  margin-top: 22px;
  gap: 12px;
}

.corpus-item {
  display: flex;
  padding: 20px 22px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.corpus-item h2,
.corpus-item p {
  margin: 0;
}

.corpus-item h2 {
  font-size: 21px;
  font-weight: 550;
}

.corpus-title {
  display: inline;
}

.corpus-title:is(p) {
  font-size: 18px;
  line-height: 1.65;
}

.corpus-speak-btn {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  padding: 0;
  margin-left: 2px;
  vertical-align: -0.14em;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.corpus-speak-btn svg {
  width: 1em;
  height: 1em;
}

.corpus-speak-btn:hover {
  color: var(--brand-deep);
  background: transparent;
  border-color: transparent;
}

.corpus-action-btn.corpus-inline-action-btn {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  padding: 0;
  margin-left: 2px;
  vertical-align: -0.14em;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.corpus-action-btn.corpus-inline-action-btn svg {
  width: 1em;
  height: 1em;
}

.corpus-item .corpus-meaning {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.65;
}

.corpus-item small {
  display: block;
  margin-top: 9px;
  color: var(--soft-text);
}

.corpus-item-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.corpus-action-btn {
  display: inline-flex;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.corpus-action-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.corpus-action-btn:hover,
.corpus-action-btn.active,
.corpus-remove-btn:hover {
  color: var(--brand);
  background: transparent;
}

.corpus-action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.corpus-empty {
  padding: 70px 20px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.corpus-empty > span {
  color: var(--brand);
  font-size: 38px;
}

.corpus-empty h2 {
  margin: 12px 0 7px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 550;
}

.corpus-empty p {
  margin: 0;
}

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

.feature-card,
.tool-grid article,
.tool-grid .tool-card,
.sync-card,
.settings-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 10px 30px rgba(75, 55, 48, 0.05);
}

.feature-card > span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--brand);
  background: var(--brand-pale);
  border-radius: 14px;
}

.feature-card h2,
.tool-grid h2,
.sync-card h2 {
  margin: 20px 0 8px;
  font-size: 20px;
  font-weight: 550;
}

.feature-card p,
.tool-grid p,
.sync-card p {
  color: var(--muted);
  line-height: 1.7;
}

.feature-card button {
  padding: 0;
  color: var(--brand);
  background: transparent;
  border: 0;
}

.tools-heading {
  margin-bottom: 22px;
}

.tool-grid .tool-card {
  display: block;
  height: 176px;
  padding: 18px 20px;
  box-sizing: border-box;
  align-self: start;
  color: inherit;
  text-align: left;
  text-decoration: none;
  vertical-align: top;
}

.tool-grid article {
  height: 176px;
  padding: 18px 20px;
  box-sizing: border-box;
  align-self: start;
}

.tool-card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.tool-card-title > svg {
  flex: 0 0 25px;
  color: var(--brand);
}

.tool-grid .tool-card-title h2 {
  margin: 0;
  min-width: 0;
}

.tool-grid p {
  display: -webkit-box;
  min-height: calc(1.7em * 3);
  margin: 18px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  text-overflow: ellipsis;
}

.tool-card-action {
  cursor: pointer;
}

.tool-card-action:hover,
.tool-card-action:focus-visible {
  border-color: rgba(207, 75, 69, 0.4);
  box-shadow: 0 12px 32px rgba(207, 75, 69, 0.1);
}

.video-audio-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 30px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(51, 57, 66, 0.2);
}

.phone-list-tool {
  display: grid;
  max-width: none;
  gap: 16px;
}

.todo-reminder-tool {
  display: block;
  width: 100%;
}

.todo-reminder-tool[hidden] {
  display: none;
}

.todo-reminder-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 96px);
  background: transparent;
  border: 0;
}

.alarm-global-toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 10px;
  pointer-events: none;
}

.alarm-global-toast {
  padding: 14px 16px;
  background: #fff;
  border-left: 4px solid var(--brand);
  border-radius: 14px;
  box-shadow: 0 16px 42px rgba(50, 43, 40, 0.16);
  pointer-events: auto;
}

.alarm-global-toast strong {
  display: block;
  color: var(--ink);
  font-weight: 550;
}

.alarm-global-toast p {
  margin: 4px 0 0;
  color: var(--muted);
}

.translation-tool,
.speech-tool {
  display: grid;
  max-width: none;
  gap: 16px;
}

.translation-tool[hidden],
.speech-tool[hidden] {
  display: none;
}

.translation-heading,
.speech-heading {
  display: grid;
  justify-items: start;
  gap: 10px;
  text-align: left;
}

.translation-heading h1,
.speech-heading h1 {
  margin: 6px 0 4px;
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 550;
}

.translation-heading p,
.speech-heading p {
  max-width: 1080px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.translation-layout,
.speech-layout {
  display: grid;
  grid-template-columns: minmax(520px, 0.92fr) minmax(560px, 1.08fr);
  gap: 16px;
  align-items: start;
}

.translation-card,
.speech-card {
  display: grid;
  padding: 18px;
  gap: 12px;
}

.translation-card-title,
.speech-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.translation-card-title h3,
.speech-card-title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 550;
}

.translation-card-title span,
.translation-status,
.speech-card-title span,
.speech-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.translation-textarea {
  min-height: 300px;
}

.speech-textarea {
  min-height: 260px;
}

.translation-options,
.speech-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.translation-source-options {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(160px, 0.35fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
}

.translation-source-summary {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.translation-actions,
.speech-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.translation-result-card .translation-actions,
.speech-result-card .speech-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.translation-status,
.speech-status {
  min-height: 46px;
  padding: 12px 14px;
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.translation-result-list {
  display: grid;
  gap: 10px;
}

.translation-result-empty,
.translation-result-row {
  padding: 14px;
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.translation-result-empty {
  color: var(--muted);
  line-height: 1.7;
}

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

.translation-result-row strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.translation-result-row p {
  margin: 0;
  color: var(--ink);
  line-height: 1.75;
}

.translation-result-row .translation-text {
  color: var(--brand);
}

.speech-range {
  width: 100%;
  accent-color: var(--brand);
}

.speech-player {
  width: 100%;
  min-height: 48px;
}

.speech-download {
  text-decoration: none;
}

.speech-download[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.58;
}

.phone-list-heading {
  display: grid;
  justify-items: start;
  gap: 12px;
  text-align: left;
}

.phone-list-heading h2 {
  margin: 6px 0 6px;
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 550;
}

.phone-list-heading p {
  max-width: 1080px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  text-align: left;
}

.phone-list-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(520px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.phone-list-card,
.phone-result-card {
  display: grid;
  gap: 12px;
}

.phone-list-card {
  padding: 18px;
}

.phone-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.phone-card-title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 550;
}

.phone-card-title span,
.phone-log {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.phone-list-textarea {
  min-height: 132px;
}

.phone-filter-textarea {
  min-height: 96px;
}

.phone-file-upload {
  display: flex;
  min-height: var(--control-height);
  padding: 6px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  cursor: pointer;
}

.phone-file-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.phone-file-upload span {
  display: inline-flex;
  min-height: 34px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 14px;
  font-weight: 550;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.24);
  border-radius: 9px;
}

.phone-file-upload strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-file-upload:hover,
.phone-file-upload:focus-within {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

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

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

.phone-list-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.phone-check {
  display: flex;
  min-height: var(--control-height);
  padding: 0 12px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.phone-check input,
.phone-field-grid input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.phone-field-grid {
  display: grid;
  padding: 2px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 7px;
}

.phone-field-grid label {
  display: flex;
  min-height: 38px;
  padding: 0 10px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}

.phone-field-grid label:has(input:checked) {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.28);
}

.phone-field-grid span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-list-actions {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) repeat(3, minmax(104px, auto));
  gap: 8px;
}

.phone-log {
  min-height: 74px;
  max-height: 132px;
  padding: 12px 14px;
  overflow: auto;
  white-space: pre-wrap;
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.phone-advanced {
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.phone-advanced summary {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--brand);
  font-weight: 550;
  cursor: pointer;
}

.phone-advanced summary::after {
  width: 16px;
  height: 16px;
  background: center / 16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cf4b45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  content: "";
}

.phone-advanced[open] summary {
  border-bottom: 1px solid var(--line);
}

.phone-advanced[open] summary::after {
  transform: rotate(180deg);
}

.phone-advanced-body {
  display: grid;
  padding: 14px;
  gap: 12px;
}

.phone-result-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.phone-result-table {
  width: 100%;
  min-width: 1360px;
  table-layout: auto;
  border-collapse: collapse;
  background: #fff;
}

.phone-result-table th,
.phone-result-table td {
  width: 1%;
  max-width: 220px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-result-table th {
  color: var(--muted);
  font-weight: 550;
  background: #faf8f7;
}

.phone-result-table .phone-plan-cell {
  width: auto;
  max-width: 1px;
}

.video-audio-dialog::backdrop {
  background: rgba(51, 57, 66, 0.48);
}

.video-audio-dialog h2 {
  margin: 0 48px 8px 0;
  font-size: 28px;
  font-weight: 550;
}

.video-audio-intro,
.video-audio-progress p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.video-audio-picker {
  display: grid;
  gap: 7px;
  margin-top: 22px;
  padding: 24px;
  color: var(--brand);
  text-align: center;
  background: var(--brand-pale);
  border: 1px dashed rgba(207, 75, 69, 0.46);
  border-radius: 15px;
  cursor: pointer;
}

.video-audio-picker strong {
  font-size: 19px;
  font-weight: 550;
}

.video-audio-picker span {
  color: var(--muted);
  font-size: 14px;
}

.video-audio-file {
  display: grid;
  margin-top: 18px;
  padding: 16px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  background: #faf8f7;
  border-radius: 13px;
}

.video-audio-file[hidden],
.video-audio-progress[hidden],
.video-audio-result[hidden] {
  display: none;
}

.video-audio-file div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.video-audio-file span {
  color: var(--muted);
  font-size: 13px;
}

.video-audio-file strong {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-audio-progress,
.video-audio-result {
  display: grid;
  margin-top: 18px;
  gap: 12px;
}

.video-audio-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-audio-progress strong,
.video-audio-result > strong {
  font-weight: 550;
}

.video-audio-progress progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  accent-color: var(--brand);
  border: 0;
  border-radius: 999px;
}

.video-audio-result audio {
  width: 100%;
}

.video-audio-result .primary-btn {
  display: grid;
  min-height: 48px;
  place-items: center;
  text-decoration: none;
}

.video-audio-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: var(--brand);
  background: var(--brand-pale);
  border-radius: 10px;
}

.video-audio-actions {
  display: grid;
  margin-top: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#cancelVideoAudio[hidden] + #startVideoAudio {
  grid-column: 1 / -1;
}

.video-audio-engine {
  position: fixed;
  top: 0;
  left: -4px;
  width: 2px;
  height: 2px;
  pointer-events: none;
  opacity: 0.001;
}

.ai-workbench {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 10px 30px rgba(75, 55, 48, 0.05);
}

.ai-workbench-heading,
.ai-workbench-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ai-workbench-heading h2 {
  margin: 5px 0 0;
  font-size: 24px;
  font-weight: 550;
}

.ai-workbench select,
.ai-workbench textarea {
  color: var(--ink);
  background: #fbf9f8;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.ai-workbench select {
  min-width: 180px;
  padding: 11px 14px;
}

.ai-workbench textarea {
  width: 100%;
  padding: 16px;
  resize: vertical;
  line-height: 1.75;
}

.ai-workbench-actions span {
  color: var(--muted);
}

.ai-workbench-result {
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.8;
  background: var(--brand-pale);
  border-radius: 12px;
}

@media (max-width: 700px) {
  .ai-workbench-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

.tool-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1380px) {
  .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .tool-grid { grid-template-columns: 1fr; }
}

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

.sync-counts {
  display: grid;
  margin: 24px 0;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sync-counts span {
  padding: 16px 8px;
  color: var(--muted);
  text-align: center;
  background: #faf8f7;
  border-radius: 11px;
}

.sync-counts strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 26px;
}

.sync-card .primary-btn,
.sync-card .secondary-btn {
  width: 100%;
}

.sync-actions {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sync-actions .primary-btn,
.sync-actions .secondary-btn {
  min-height: 46px;
  padding: 0 12px;
}

@media (max-width: 700px) {
  .sync-actions {
    grid-template-columns: 1fr;
  }
}

.settings-card {
  max-width: 880px;
}

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

.provider-options legend {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 550;
}

.provider-options label {
  display: flex;
  padding: 18px;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.provider-options strong,
.provider-options small {
  display: block;
}

.provider-options small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.custom-api-fields {
  display: grid;
  margin: 22px 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.custom-api-fields label {
  color: var(--muted);
  font-size: 14px;
}

.custom-api-fields input {
  width: 100%;
  min-height: 46px;
  margin-top: 7px;
  padding: 0 13px;
  background: #faf9f8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-status {
  margin-left: 12px;
  color: var(--success);
  font-size: 13px;
}

.settings-tabs {
  display: grid;
  max-width: 980px;
  margin-bottom: 18px;
  padding: 5px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  background: #eeeae7;
  border-radius: 13px;
}

.settings-tabs button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.settings-tabs button.active {
  color: var(--brand-dark);
  background: #fff;
  box-shadow: 0 2px 8px rgba(65, 45, 38, 0.06);
}

.ai-service-tabs {
  max-width: none;
  margin-bottom: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#aiSettingsForm,
.settings-panel {
  width: 100%;
  max-width: none;
  min-width: 0;
}

#settingsView.portal-view {
  width: min(1480px, calc(100% - 64px));
}

#aiSettingsForm {
  display: block;
}

.settings-panel {
  display: grid;
  gap: 16px;
  align-items: stretch;
  justify-items: stretch;
}

.ai-services-panel > [data-ai-service-panel] {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.settings-service-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 8px 24px rgba(75, 55, 48, 0.04);
}

.settings-card-heading,
.model-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.settings-card-heading > div {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 14px;
}

.settings-card-heading h2,
.settings-card-heading p {
  grid-column: 2;
}

.settings-card-heading h2 {
  margin: 1px 0 5px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 550;
}

.settings-card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.settings-icon {
  display: grid;
  width: 44px;
  height: 44px;
  grid-row: 1 / span 2;
  place-items: center;
  color: var(--brand);
  background: var(--brand-pale);
  border-radius: 13px;
}

.service-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  color: var(--brand-dark);
  background: var(--brand-pale);
  border-radius: 999px;
  font-size: 12px;
}

.service-badge.free {
  color: #32745a;
  background: #edf7f2;
}

.settings-field-grid,
.settings-custom-fields {
  display: grid;
  margin-top: 22px;
  grid-template-columns: 1fr;
  gap: 15px;
}

.settings-field-grid.two,
.settings-custom-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-field-grid label,
.settings-custom-fields label {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-field-grid label > span:first-child,
.settings-custom-fields label > span:first-child {
  display: block;
  margin-bottom: 7px;
}

.settings-field-grid input:not([type="checkbox"]):not([type="range"]),
.settings-field-grid select,
.settings-custom-fields input,
.settings-custom-fields select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: #faf9f8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-model-note {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.settings-source-note {
  display: grid;
  margin-top: 18px;
  padding: 14px 16px;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-source-note strong {
  color: var(--ink);
  font-weight: 500;
}

.llm-billing-panel {
  gap: 16px;
}

.llm-billing-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
}

.llm-billing-summary > strong {
  color: var(--brand);
  font-size: 22px;
}

.llm-billing-summary > small {
  grid-column: 1 / -1;
}

.llm-linked-services {
  display: grid;
  margin: 8px 0 0;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  list-style: none;
}

.llm-linked-services li {
  display: flex;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-radius: 8px;
}

.llm-linked-services li strong {
  color: var(--brand-dark);
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .llm-linked-services {
    grid-template-columns: 1fr;
  }
}

.model-download-row {
  display: flex;
  grid-column: 1 / -1;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.model-download-row strong,
.model-download-row small {
  display: block;
}

.model-download-row strong {
  color: var(--ink);
  font-weight: 500;
}

.model-download-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.model-download-row a.secondary-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.download-pending {
  flex-shrink: 0;
  color: var(--soft-text);
  font-size: 12px;
}

.device-detection-summary {
  grid-column: 1 / -1;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.device-detection-summary strong {
  color: var(--ink);
  font-weight: 550;
}

.model-catalog-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 16px;
}

[data-ai-service-panel="desktop"] > .device-detection-summary,
[data-ai-service-panel="desktop"] > .model-catalog-list {
  margin-top: 16px;
}

.model-config-fields {
  grid-template-columns: 1fr;
}

.model-config-status,
.model-config-progress {
  grid-column: 1 / -1;
}

.model-config-status {
  margin-top: 0;
}

.local-model-card {
  display: grid;
  min-width: 0;
  padding: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: #fbf8f7;
  border: 1px solid rgba(207, 75, 69, 0.12);
  border-radius: 16px;
}

.local-model-card.selected {
  background: rgba(207, 75, 69, 0.035);
}

.local-model-card.incompatible {
  background: #f6f4f3;
}

.local-model-copy {
  min-width: 0;
}

.local-model-heading,
.local-model-tags,
.local-model-meta,
.local-model-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.local-model-heading strong {
  overflow: hidden;
  max-width: 100%;
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-tag {
  padding: 4px 8px;
  color: var(--brand-dark);
  font-size: 12px;
  background: var(--brand-pale);
  border-radius: 999px;
}

.model-tag.compatible {
  color: #32745a;
  background: #edf7f2;
}

.model-tag.incompatible {
  color: #8b5f54;
  background: #eee9e7;
}

.local-model-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.local-model-meta {
  margin-top: 9px;
  color: var(--soft-text);
  font-size: 13px;
}

.local-model-meta span + span::before {
  margin-right: 8px;
  color: var(--line-strong);
  content: "|";
}

.model-compatibility-reason {
  display: block;
  margin-top: 8px;
  color: #8b5f54;
  font-size: 13px;
  line-height: 1.55;
}

.model-download-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.local-model-actions {
  width: 168px;
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: center;
}

.local-model-actions .secondary-btn,
.local-model-actions .primary-btn {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.local-model-actions button:disabled,
.local-model-actions a[aria-disabled="true"] {
  color: var(--soft-text);
  pointer-events: none;
  background: #f3f1f0;
  border-color: var(--line);
}

.system-voice-option {
  display: flex;
  grid-column: 1 / -1;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.system-voice-option strong,
.system-voice-option small {
  display: block;
}

.system-voice-option strong {
  color: var(--ink);
  font-weight: 550;
}

.system-voice-option small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.settings-choice {
  display: flex;
  padding: 15px;
  align-items: flex-start;
  gap: 11px;
  background: #faf9f8;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.settings-choice input {
  margin-top: 3px;
  accent-color: var(--brand);
}

.settings-choice strong,
.settings-choice small {
  display: block;
}

.settings-choice strong {
  color: var(--ink);
  font-weight: 500;
}

.settings-choice small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.settings-range {
  grid-column: 1 / -1;
}

.settings-range span {
  display: flex !important;
  justify-content: space-between;
}

.settings-range input {
  width: 100%;
  accent-color: var(--brand);
}

.model-status-row {
  margin-top: 22px;
  align-items: center;
}

.model-status-row strong,
.model-status-row small {
  display: block;
}

.model-status-row strong {
  color: var(--ink);
  font-weight: 500;
}

.model-status-row small,
.settings-helper {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.settings-progress {
  height: 5px;
  margin-top: 13px;
  overflow: hidden;
  background: #eeeae7;
  border-radius: 5px;
}

.settings-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  transition: width 180ms ease;
}

.settings-save-bar {
  display: flex;
  max-width: 980px;
  margin-top: 18px;
  padding: 16px 0;
  align-items: center;
}

html[data-reading-size="large"] .focus-card .sentence-text {
  font-size: clamp(23px, 2vw, 28px);
}

html[data-reading-size="extra-large"] .focus-card .sentence-text {
  font-size: clamp(26px, 2.25vw, 31px);
}

html[data-density="compact"] .settings-service-card {
  padding: 18px;
}

html[data-density="compact"] .settings-panel {
  gap: 11px;
}

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

.library-heading-copy {
  min-width: 0;
  max-width: 920px;
}

.library-heading h1 {
  margin: 9px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 550;
  letter-spacing: -0.03em;
}

.library-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.library-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.local-import-menu {
  position: relative;
}

.local-import-menu summary {
  display: inline-flex;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.local-import-menu summary::-webkit-details-marker {
  display: none;
}

.local-import-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.material-library-clear-btn {
  gap: 8px;
  white-space: nowrap;
}

.material-library-action-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.local-import-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.local-import-options button {
  display: flex;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  align-items: center;
  border-radius: 8px;
}

.local-import-options button:hover {
  background: var(--brand-pale);
}

.library-toolbar {
  display: grid;
  grid-template-areas: "status search type";
  grid-template-columns: auto minmax(260px, 1fr) auto;
  margin-top: 26px;
  padding: 10px;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.library-search {
  display: flex;
  grid-area: search;
  width: 100%;
  min-height: 46px;
  padding: 0 15px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.library-search input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
}

.library-status-filter,
.library-filter,
.record-tabs {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: #eeeae7;
  border-radius: 11px;
}

.library-status-filter button,
.library-filter button,
.record-tabs button {
  min-height: 36px;
  padding: 0 15px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.library-status-filter button.active,
.library-filter button.active,
.record-tabs button.active {
  color: var(--brand);
  font-weight: 550;
  background: #fff;
}

.library-status-filter {
  grid-area: status;
  width: max-content;
  margin: 0;
}

.library-filter {
  grid-area: type;
}

.library-status-filter button span {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  margin-left: 5px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
}

.record-tabs {
  width: max-content;
  margin-top: 26px;
}

.queue-toolbar {
  display: flex;
  margin-top: 16px;
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.18);
  border-radius: 12px;
}

.queue-toolbar span {
  margin-right: auto;
  color: var(--muted);
}

.queue-status {
  margin-top: 14px;
  padding: 12px 16px;
  color: var(--brand-dark);
  background: #fff;
  border-left: 3px solid var(--brand);
  border-radius: 8px;
}

.material-grid {
  display: grid;
  margin-top: 22px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

#learningRecordGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.material-card {
  position: relative;
  display: flex;
  min-height: 250px;
  padding: 20px;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(75, 55, 48, 0.05);
}

.material-card.just-imported {
  border-color: rgba(207, 75, 69, 0.72);
  box-shadow: 0 0 0 4px rgba(207, 75, 69, 0.12), var(--shadow);
}

.material-card.selected {
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.4);
}

.material-card.ready {
  border-top: 3px solid var(--success);
}

.material-card-top,
.material-card-top-left,
.material-card-top-actions,
.material-card-meta,
.material-card-actions,
.material-progress-label {
  display: flex;
  align-items: center;
}

.material-card-top {
  justify-content: space-between;
  gap: 12px;
}

.material-card-top-left,
.material-card-top-actions {
  min-width: 0;
  gap: 9px;
}

.material-card-top-actions {
  flex: none;
}

.material-check {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  accent-color: var(--brand);
}

.material-kind,
.material-status {
  display: inline-flex;
  min-height: 28px;
  padding: 0 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  background: #f2efed;
  border-radius: 14px;
}

.material-kind {
  gap: 6px;
}

.material-kind svg {
  width: 17px;
  height: 17px;
}

.material-status-icon,
.material-remove-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.material-status-icon svg,
.material-remove-icon svg {
  width: 20px;
  height: 20px;
}

.material-status-icon.ready {
  color: var(--success);
}

.material-remove-icon {
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, opacity 160ms ease;
}

.material-remove-icon:hover,
.material-remove-icon:focus-visible {
  color: var(--brand);
  background: transparent;
  outline: 0;
}

.material-status.ready {
  color: var(--success);
  background: #edf5f0;
}

.material-status.processing,
.material-status.queued {
  color: var(--brand-dark);
  background: var(--brand-pale);
}

.material-status.failed {
  color: #a34a42;
  background: #fff0ef;
}

.material-card h2 {
  margin: 20px 0 8px;
  overflow: hidden;
  font-size: 18px;
  font-weight: 550;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.material-path {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card-meta {
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 13px;
}

.material-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: var(--brand-dark);
  background: var(--brand-pale);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.material-progress {
  margin-top: 16px;
}

.material-progress-label {
  margin-bottom: 7px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.material-progress-track {
  height: 6px;
  overflow: hidden;
  background: #eeeae7;
  border-radius: 6px;
}

.material-progress-track span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.material-card-actions {
  display: grid;
  margin-top: auto;
  padding-top: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}

.material-card-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 8px;
  color: var(--brand);
  font-size: 14px;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.2);
  border-radius: 8px;
  white-space: nowrap;
}

.material-card-actions .material-category-select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-width: none;
  padding: 0 40px 0 12px;
  color: var(--brand);
  font-size: 14px;
  background-color: var(--brand-pale);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cf4b45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid rgba(207, 75, 69, 0.25);
  border-radius: 8px;
  outline: 0;
  appearance: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.material-card-actions .material-category-select:hover {
  border-color: rgba(207, 75, 69, 0.45);
}

.material-card-actions .material-category-select:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.1);
}

.material-card-actions button.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.material-card-actions button.danger {
  margin-left: 0;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.library-empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

.library-empty > span {
  display: block;
  color: var(--brand);
  font-size: 42px;
}

.library-empty h2 {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 550;
}

.library-empty p {
  margin: 0;
}

.workspace {
  min-height: calc(100vh - 72px);
  padding: 24px;
}

.workspace-grid {
  display: grid;
  min-height: calc(100vh - 190px);
  grid-template-columns: minmax(240px, 0.72fr) minmax(480px, 1.6fr) minmax(260px, 0.82fr);
  align-items: start;
  gap: 16px;
  font-family: var(--reading-font);
}

.workspace {
  font-size: 16px;
  line-height: 1.65;
}

.sentence-panel,
.study-panel,
.lookup-panel {
  min-width: 0;
}

.sentence-panel,
.lookup-panel {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.sentence-panel {
  display: flex;
  flex-direction: column;
}

.panel-heading {
  display: flex;
  min-height: 72px;
  padding: 16px 18px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 550;
}

.panel-heading .sentence-panel-title {
  width: 100%;
  min-width: 0;
  overflow: visible;
  margin: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
}

.icon-btn {
  width: 36px;
  height: 36px;
  color: var(--brand);
  background: var(--brand-pale);
  border: 1px solid #ead2ce;
  border-radius: 9px;
}

.sentence-list {
  min-width: 0;
  min-height: 0;
  flex: 1;
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.sentence-item {
  position: relative;
  display: block;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.sentence-item:hover {
  background: #faf8f7;
}

.sentence-item.active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.sentence-item.active .sentence-copy {
  color: var(--brand);
}

.sentence-select {
  display: flow-root;
  min-width: 0;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: transparent;
  border: 0;
}

.sentence-heart {
  position: static;
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  padding: 0;
  margin-left: 7px;
  align-items: center;
  justify-content: center;
  color: #a4a7ad;
  font-size: 17px;
  line-height: 1;
  background: transparent;
  border: 0;
  vertical-align: -0.12em;
}

.sentence-heart svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sentence-heart:hover,
.sentence-heart.saved {
  color: var(--brand);
  background: transparent;
}

.sentence-heart.saved svg {
  fill: currentColor;
}

.sentence-item.done .sentence-number {
  color: #fff;
  background: var(--success);
}

.sentence-item.active .sentence-number {
  color: #fff;
  background: var(--brand);
}

.sentence-number {
  position: relative;
  top: 4.2px;
  display: inline-grid;
  width: 18px;
  height: 18px;
  float: left;
  margin: 0 8px 0 0;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  background: #ece9e7;
  border: 0;
  border-radius: 50%;
}

.sentence-copy {
  display: block;
  min-width: 0;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
}

.sentence-ending {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.sentence-word {
  display: inline;
  padding: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
}

.sentence-word:hover,
.sentence-word.selected {
  color: var(--brand);
  background: transparent;
}

.sentence-copy small {
  display: block;
  overflow: visible;
  margin-top: 5px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sentence-copy small.translation-placeholder {
  color: var(--soft-text);
}

.study-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.media-card,
.focus-card,
.practice-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.media-card {
  padding: 14px 18px;
}

.media-card audio {
  width: 100%;
  height: 40px;
}

.media-card video {
  width: 100%;
  max-height: 430px;
  margin-bottom: 10px;
  background: #2e2e31;
  border-radius: 10px;
}

.media-actions {
  display: flex;
  margin-top: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.media-actions button,
.sentence-tools button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  background: #f7f5f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.media-actions button.accent {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.loop-control {
  display: inline-flex;
  min-height: 36px;
  padding: 0 8px;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.loop-control input {
  accent-color: var(--brand);
}

.focus-card {
  padding: clamp(16px, 2.2vw, 26px);
}

.sentence-text {
  margin: 0 0 10px;
  font-family: var(--reading-font);
  font-size: clamp(20px, 1.65vw, 26px);
  font-weight: 400;
  line-height: 1.65;
}

.word-token {
  display: inline;
  padding: 2px 1px;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
  text-decoration: none;
}

.word-token:hover,
.word-token.selected {
  color: var(--brand);
  background: transparent;
  text-decoration: none;
  box-shadow: none;
}

.word-token.playing {
  color: var(--brand);
  background: rgba(207, 75, 69, 0.1);
  border-radius: 4px;
}

.sentence-translation {
  margin: 0 0 14px;
  color: var(--muted);
  font-family: var(--reading-font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

.sentence-tools {
  display: flex;
  padding-top: 14px;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.practice-tabs {
  display: flex;
  padding: 5px;
  gap: 4px;
  background: #ebe8e6;
  border-radius: 11px;
}

.practice-tab {
  flex: 1;
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.practice-tab.active {
  color: var(--brand);
  font-weight: 550;
  background: #fff;
}

.practice-card {
  padding: 20px;
}

.practice-card > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.practice-card label {
  margin-top: 0;
}

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

.practice-result {
  margin-top: 16px;
  padding: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  background: #f8f7f6;
  border-radius: 10px;
}

.practice-result strong {
  color: var(--ink);
  font-weight: 550;
}

.practice-result .correct {
  color: var(--success);
}

.practice-result .incorrect {
  color: var(--brand);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.record-btn {
  display: flex;
  min-height: 48px;
  padding: 0 18px;
  align-items: center;
  gap: 10px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
}

.record-btn span {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
}

.record-btn b {
  font-weight: 550;
}

.record-btn.recording span {
  border-radius: 2px;
  animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
  50% { opacity: 0.45; }
}

.autosave {
  display: block;
  margin-top: 8px;
  color: var(--soft-text);
  font-size: 16px;
  line-height: 1.65;
  text-align: right;
}

.lookup-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 66px;
  font-family: var(--reading-font);
  font-weight: 400;
}

.lookup-panel-heading {
  flex: 0 0 auto;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.lookup-scroll {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sentence-list,
.lookup-scroll {
  scrollbar-gutter: stable;
  scrollbar-color: rgba(207, 75, 69, 0.5) transparent;
  scrollbar-width: thin;
}

.sentence-list::-webkit-scrollbar,
.lookup-scroll::-webkit-scrollbar {
  width: 7px;
  height: 0;
}

.sentence-list::-webkit-scrollbar-track,
.lookup-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sentence-list::-webkit-scrollbar-thumb,
.lookup-scroll::-webkit-scrollbar-thumb {
  background: rgba(207, 75, 69, 0.38);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.sentence-list::-webkit-scrollbar-thumb:hover,
.lookup-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(207, 75, 69, 0.62);
  background-clip: padding-box;
}

@media (min-width: 721px) {
  .sentence-panel,
  .lookup-panel {
    height: auto;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    align-self: start;
  }
}

.stage-vocab-card {
  order: 1;
  width: 100%;
  min-width: 0;
  padding: 14px 16px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.stage-vocab-heading h2 {
  display: flex;
  min-width: 64px;
  min-height: 56px;
  flex: 0 0 64px;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

.stage-vocab-heading .stage-vocab-select {
  width: auto;
  height: 56px;
  min-width: 0;
  min-height: 56px;
  flex: 1;
  margin-left: auto;
  padding-left: 12px;
  color: var(--ink);
  background-color: #fff;
  border-color: #ead2ce;
  box-shadow: none;
}

.stage-vocab-heading .stage-vocab-select:hover,
.stage-vocab-heading .stage-vocab-select:focus-visible {
  background-color: #fff;
  box-shadow: none;
}

.stage-vocab-heading .stage-vocab-select option {
  color: var(--ink);
  background: #fff;
}

.stage-vocab-list {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.stage-vocab-item {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: #faf8f7;
  border: 1px solid transparent;
  border-radius: 9px;
}

.stage-vocab-item:hover {
  border-color: #ead2ce;
}

.stage-vocab-content {
  min-width: 0;
  flex: 1;
}

.stage-vocab-word {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}

.stage-vocab-word > span:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-vocab-word strong {
  color: var(--brand);
  font-family: var(--reading-font);
  font-size: 17px;
  font-weight: 400;
}

.stage-vocab-word small {
  min-width: 0;
  color: var(--soft-text);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
}

.stage-vocab-dictionary {
  display: block;
  min-width: 0;
  margin-top: 5px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-vocab-phonetic,
.stage-vocab-definitions,
.stage-vocab-definition {
  display: block;
}

.stage-vocab-phonetic {
  color: var(--muted);
  font-size: 17px;
}

.stage-vocab-definitions {
  margin-top: 2px;
}

.stage-vocab-definitions.collapsed {
  max-height: 1.55em;
  overflow: hidden;
}

.stage-vocab-definition {
  display: block;
  color: var(--ink);
  line-height: 1.6;
}

.stage-vocab-definition-index {
  position: relative;
  top: 3.75px;
  display: inline-grid;
  width: 15px;
  height: 15px;
  float: left;
  margin: 0 5px 0 0;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  background: #ece9e7;
  border-radius: 50%;
}

.stage-vocab-definition-copy {
  display: inline;
}

.stage-vocab-definition + .stage-vocab-definition {
  margin-top: 3px;
}

.stage-vocab-definition em {
  margin-right: 5px;
  color: inherit;
  font-style: normal;
}

.stage-vocab-expand {
  margin-top: 5px;
  padding: 2px 0;
  color: var(--brand);
  font-size: 16px;
  line-height: 1.65;
  background: transparent;
  border: 0;
}

.stage-vocab-expand:hover {
  color: var(--ink);
}

.media-reconnect {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.media-reconnect p {
  margin: 0 0 12px;
}

.stage-vocab-heart {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 20px;
  background: transparent;
  border: 0;
}

.stage-vocab-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.stage-vocab-toggle {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.stage-vocab-toggle[hidden] {
  display: none;
}

.stage-vocab-toggle:hover {
  color: var(--brand);
  background: var(--brand-pale);
}

.stage-vocab-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-vocab-heart.saved {
  color: var(--brand);
  background: transparent;
}

.stage-vocab-empty,
.stage-vocab-limit {
  margin: 0;
  padding: 16px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}


.word-lookup-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  max-height: min(84vh, 760px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--reading-font);
  font-weight: 400;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(40, 31, 29, 0.26);
}

.word-lookup-dialog::backdrop {
  background: rgba(32, 27, 25, 0.48);
}

html.word-lookup-open,
body.word-lookup-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.word-lookup-close {
  z-index: 2;
}

.word-lookup-close svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.lookup-content {
  display: flex;
  min-width: 0;
  max-height: min(84vh, 760px);
  flex-direction: column;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.word-lookup-header {
  flex: 0 0 auto;
  padding: 28px 72px 20px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.word-lookup-scroll {
  min-height: 0;
  flex: 1;
  padding: 20px 32px 30px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(207, 75, 69, 0.5) transparent;
  scrollbar-width: thin;
}

.word-lookup-scroll::-webkit-scrollbar {
  width: 7px;
}

.word-lookup-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.word-lookup-scroll::-webkit-scrollbar-thumb {
  background: rgba(207, 75, 69, 0.38);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

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

.word-heading h3 {
  margin: 0;
  font-family: var(--reading-font);
  font-size: 30px;
  font-weight: 400;
}

.word-identity {
  min-width: 0;
}

.word-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.word-heading #lookupPhonetic {
  display: inline;
  margin: 0 2px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.word-heading .lookup-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.word-heading .lookup-icon-button:hover,
.word-heading .lookup-icon-button:focus-visible,
.word-heading .favorite-word-icon.saved {
  color: var(--brand);
  background: transparent;
}

.word-heading .lookup-icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.word-heading .favorite-word-icon.saved svg {
  fill: currentColor;
}

.definition-list {
  margin-top: 8px;
}

.definition-item {
  padding: 2px 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

.definition-item em {
  margin-right: 8px;
  color: var(--brand);
  font-size: 13px;
}

.lookup-content section {
  margin-top: 22px;
}

.lookup-content .lookup-definition-section {
  margin-top: 0;
}

.lookup-content h4 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 550;
}

.lookup-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.lookup-row-main {
  display: inline;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
}

.lookup-row:last-child {
  margin-bottom: 0;
}

.lookup-row-translation {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

.lookup-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  line-height: 1;
  white-space: nowrap;
  vertical-align: -0.12em;
}

.lookup-inline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  padding: 0;
  color: var(--muted);
  font: inherit;
  background: transparent;
  border: 0;
}

.lookup-inline-action:hover,
.lookup-inline-action:focus-visible,
.lookup-inline-action.saved {
  color: var(--brand);
  background: transparent;
}

.lookup-inline-action svg {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lookup-inline-action.saved svg {
  fill: currentColor;
}

@media (max-width: 560px) {
  .word-lookup-header {
    padding: 24px 54px 18px 20px;
  }

  .word-lookup-scroll {
    padding: 18px 20px 26px;
  }
}

.vocab-summary {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 58px;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  background: #faf8f7;
  border-top: 1px solid var(--line);
}

.vocab-summary strong {
  color: var(--brand);
  font-size: 20px;
  font-weight: 550;
}

.model-dialog {
  width: min(calc(100% - 32px), 480px);
  padding: 30px;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(40, 31, 29, 0.26);
}

.model-download-pay-dialog,
.model-download-confirm-dialog,
.model-enable-dialog,
.membership-dialog {
  width: min(calc(100% - 32px), 430px);
  padding: 30px;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(40, 31, 29, 0.26);
}

.model-download-pay-dialog::backdrop,
.model-download-confirm-dialog::backdrop,
.model-enable-dialog::backdrop,
.membership-dialog::backdrop {
  background: rgba(39, 33, 32, 0.45);
  backdrop-filter: blur(3px);
}

.model-download-pay-dialog h2,
.model-download-confirm-dialog h2,
.model-enable-dialog h2,
.membership-dialog h2 {
  margin: 12px 0 8px;
  font-size: 23px;
  font-weight: 550;
}

.model-download-pay-dialog > p,
.model-download-confirm-dialog > p,
.model-enable-dialog > p,
.membership-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.model-payment-qrcode {
  display: grid;
  width: 220px;
  min-height: 220px;
  margin: 20px auto 14px;
  place-items: center;
  color: var(--muted);
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.model-payment-qrcode img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 13px;
}

.model-payment-qrcode span {
  padding: 20px;
  font-size: 13px;
}

.model-payment-status {
  margin-bottom: 16px;
  color: var(--brand);
  font-size: 14px;
}

.model-download-pay-dialog > .secondary-btn {
  width: 100%;
}

.membership-dialog {
  width: min(calc(100% - 32px), 620px);
  height: min(66dvh, 720px);
  max-height: min(66dvh, 720px);
  padding: 28px;
  text-align: left;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
}

.membership-payment-dialog {
  display: block;
  height: auto;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

/* Native dialogs must stay out of layout until JavaScript explicitly opens them.
   The component display modes above otherwise override the browser's
   dialog:not([open]) rule and expose the payment panel during login. */
.membership-dialog[hidden],
.membership-dialog:not([open]),
body:not(.membership-flow-active) .membership-dialog {
  display: none !important;
}

.membership-dialog-heading {
  padding-right: 48px;
}

.membership-dialog-heading h2 {
  margin: 10px 0 6px;
}

.membership-dialog-heading > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.membership-plan-list {
  display: grid;
  min-height: 0;
  margin: 18px -8px 0 0;
  padding: 0 8px 0 0;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.membership-dialog-footer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.membership-plan-card {
  display: block;
  width: 100%;
  padding: 15px 16px;
  color: var(--ink);
  text-align: left;
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.membership-plan-card.active {
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.5);
}

.membership-plan-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.membership-plan-heading strong {
  font-size: 17px;
  font-weight: 550;
}

.membership-plan-heading span {
  color: var(--brand);
  font-size: 17px;
}

.membership-feature-description {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.membership-plan-tabs {
  display: grid;
  margin: 14px 0 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.membership-plan-tabs button {
  min-height: 40px;
  color: var(--muted);
  background: #faf8f7;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.membership-plan-tabs button.active {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.35);
}

.membership-payment-dialog > p {
  min-height: 26px;
  text-align: center;
}

.membership-quote-summary {
  min-height: 22px;
  margin: 10px 0 !important;
  color: var(--ink) !important;
  text-align: center;
  font-size: 15px;
}

.membership-purchase-btn {
  width: 100%;
  min-height: 42px;
}

.membership-qrcode {
  display: grid;
  width: 220px;
  min-height: 220px;
  margin: 18px auto 14px;
  place-items: center;
  color: var(--muted);
  background: #faf8f6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.membership-qrcode img {
  display: block;
  width: 100%;
  border-radius: 13px;
}

.membership-qrcode span {
  padding: 20px;
  text-align: center;
}

.membership-payment-dialog .model-payment-status {
  text-align: center;
}

.membership-payment-dialog > .secondary-btn {
  width: 100%;
}

@media (max-width: 700px) {
  .membership-dialog {
    width: calc(100% - 24px);
    height: min(66dvh, 680px);
    max-height: min(66dvh, 680px);
    padding: 22px 18px;
  }

  .membership-plan-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .membership-plan-tabs button {
    min-height: 38px;
    padding: 7px 4px;
    font-size: 14px;
  }
}

.model-download-confirm-cost {
  margin: 20px 0;
  padding: 14px 16px;
  color: var(--brand-dark);
  font-size: 16px;
  font-weight: 500;
  background: var(--brand-pale);
  border-radius: 10px;
}

.model-download-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.model-download-confirm-actions .secondary-btn,
.model-download-confirm-actions .primary-btn {
  width: 100%;
  min-height: 42px;
  font-weight: 500;
}

.model-enable-dialog {
  width: min(calc(100% - 32px), 520px);
  text-align: left;
}

.model-enable-steps {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 18px 0;
  list-style: none;
}

.model-enable-steps li {
  display: grid;
  grid-template-columns: minmax(112px, auto) 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: #fbfaf9;
  border: 1px solid var(--control-border);
  border-radius: 14px;
}

.model-enable-steps strong {
  color: var(--ink);
  font-weight: 550;
}

.model-enable-steps span {
  color: var(--muted);
  line-height: 1.5;
}

.model-enable-status {
  min-height: 48px;
  padding: 12px 14px;
  color: var(--muted);
  background: #fbfaf9;
  border: 1px solid var(--control-border);
  border-radius: 14px;
  line-height: 1.5;
}

.model-enable-status[data-status="success"] {
  color: var(--success);
  background: #f2faf5;
  border-color: rgba(77, 125, 98, 0.22);
}

.model-enable-status[data-status="warning"] {
  color: var(--warning);
  background: #fff8ed;
  border-color: rgba(165, 107, 44, 0.22);
}

.model-enable-status[data-status="error"] {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.24);
}

.model-enable-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.model-enable-actions .secondary-btn,
.model-enable-actions .primary-btn {
  min-height: 42px;
}

.model-dialog::backdrop {
  background: rgba(39, 33, 32, 0.45);
  backdrop-filter: blur(3px);
}

.model-dialog h2 {
  margin: 12px 0;
  font-size: 24px;
  font-weight: 550;
}

.model-dialog > p {
  color: var(--muted);
  line-height: 1.75;
}

.model-package-panel {
  display: flex;
  margin-top: 20px;
  padding: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--brand-pale);
  border: 1px solid rgba(207, 75, 69, 0.18);
  border-radius: 14px;
}

.model-package-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.model-package-copy strong {
  color: var(--brand);
  font-weight: 550;
}

.model-package-copy span {
  overflow-wrap: anywhere;
}

.model-package-copy small {
  color: var(--muted);
  line-height: 1.5;
}

.model-package-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
}

.model-package-actions .text-btn {
  color: var(--muted);
  font-size: 13px;
}

.model-prepare-btn {
  width: 100%;
  margin-top: 20px;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  color: var(--muted);
  font-size: 22px;
  background: #f3f1f0;
  border: 0;
  border-radius: 50%;
}

.model-dialog dl {
  margin: 22px 0 0;
  border-top: 1px solid var(--line);
}

.model-dialog dl div {
  display: grid;
  padding: 13px 0;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.model-dialog dt {
  color: var(--muted);
}

.model-dialog dd {
  margin: 0;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 30px;
  max-width: min(90vw, 440px);
  padding: 12px 18px;
  color: #fff;
  font-size: 14px;
  text-align: center;
  background: rgba(51, 57, 66, 0.95);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.mobile-nav {
  display: none;
}

@media (max-width: 1100px) {
  #learningRecordGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 230px minmax(0, 1fr);
  }

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

}

@media (max-width: 820px) {
  .learning-section-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notes-center-tabs {
    width: 100%;
  }

  .notes-center-tabs button {
    flex: 1;
  }

  .material-summary-open {
    align-items: flex-start;
    flex-direction: column;
  }

  .desktop-install-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .learning-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .learning-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .learning-dashboard-card {
    padding: 16px;
  }

  .study-week-chart {
    gap: 4px;
  }

  .learning-record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .record-category-controls,
  .record-category-create {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .record-category-filter {
    width: 100%;
  }

  .record-category-filter select,
  .record-category-create input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .learning-record-toolbar .record-tabs {
    align-self: flex-end;
    margin-left: 0;
  }

  .material-category-select {
    max-width: none;
    width: 100%;
  }

  .subtitle-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .subtitle-dialog-heading,
  .subtitle-editor-toolbar,
  .subtitle-dialog-actions {
    padding: 14px;
  }

  .subtitle-editor-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .subtitle-editor-toolbar > div {
    width: 100%;
    overflow-x: auto;
  }

  .subtitle-editor-list {
    max-height: calc(100vh - 285px);
    padding: 12px;
  }

  .subtitle-editor-row {
    grid-template-columns: 34px 1fr 1fr 38px;
  }

  .subtitle-editor-row .subtitle-source,
  .subtitle-editor-row .subtitle-translation {
    grid-column: 2 / -1;
  }

  .subtitle-editor-row .subtitle-delete {
    grid-column: 4;
    grid-row: 1;
  }

  .model-package-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .model-package-actions {
    grid-template-columns: 1fr auto;
  }

  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .site-header {
    position: sticky;
    top: 0;
    bottom: auto;
    display: grid;
    width: 100%;
    min-height: 64px;
    padding: 10px 14px;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .top-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    max-height: calc(100vh - 64px);
    margin: 0;
    padding: 10px 14px 16px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 30px rgba(75, 55, 48, 0.1);
  }

  .top-nav.open {
    display: flex;
  }

  .top-nav button {
    flex: 0 0 auto;
    justify-content: flex-start;
    font-size: 14px;
  }

  .sidebar-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    background: #faf8f7;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .header-actions {
    margin: 0;
    align-items: center;
    flex-direction: row;
  }

  .miniapp-sidebar-card {
    display: none;
  }

  main {
    width: 100%;
    margin-left: 0;
  }

  .portal-view {
    width: calc(100% - 28px);
    padding: 28px 0 48px;
  }

  #toolsView {
    width: calc(100% - 28px);
    margin-right: auto;
    margin-left: auto;
  }

  .feature-grid,
  .translation-layout,
  .speech-layout,
  .phone-list-layout,
  .sync-grid {
    grid-template-columns: 1fr;
  }

  .translation-options,
  .translation-source-options,
  .translation-actions,
  .translation-result-card .translation-actions,
  .speech-options,
  .speech-actions,
  .speech-result-card .speech-actions {
    grid-template-columns: 1fr;
  }

  .provider-options,
  .custom-api-fields,
  .settings-field-grid.two,
  .settings-custom-fields {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
  }

  .ai-service-tabs {
    grid-template-columns: repeat(5, minmax(108px, 1fr));
  }

  .settings-service-card {
    padding: 20px 16px;
  }

  .settings-card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .service-badge {
    align-self: flex-start;
  }

  .model-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .local-model-card {
    grid-template-columns: 1fr;
  }

  .local-model-actions {
    width: 100%;
    justify-content: stretch;
  }

  .local-model-actions .secondary-btn,
  .local-model-actions .primary-btn {
    width: 100%;
    flex: none;
  }

  .library-view {
    width: calc(100% - 28px);
    padding: 28px 0 48px;
  }

  .library-heading,
  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .library-toolbar {
    grid-template-areas: "status" "type" "search";
    grid-template-columns: minmax(0, 1fr);
  }

  .library-status-filter {
    width: 100%;
  }

  .library-status-filter button {
    flex: 1;
  }

  .library-heading h1 {
    font-size: 32px;
  }

  .library-heading-actions {
    width: 100%;
  }

  .local-import-menu,
  .local-import-menu summary {
    width: auto;
  }

  .local-import-options {
    right: auto;
    left: 0;
    width: 100%;
  }

  .library-filter {
    width: 100%;
    overflow-x: auto;
  }

  .library-filter button {
    flex: 1 0 auto;
  }

  .queue-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-toolbar span {
    margin-right: 0;
  }

  .material-grid {
    grid-template-columns: 1fr;
  }

  #learningRecordGrid {
    grid-template-columns: 1fr;
  }

  .model-chip {
    max-width: 116px;
    min-height: 34px;
    padding: 0 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .member-button {
    max-width: 96px;
    padding: 0 6px;
  }

  .member-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-gate {
    min-height: calc(100vh - 62px);
  }

  .auth-card {
    padding: 30px 20px;
  }

  .model-chip span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .welcome {
    display: block;
    min-height: auto;
    padding: 42px 16px 30px;
  }

  .welcome-copy {
    margin: 0 auto 34px;
  }

  .welcome h1 {
    margin: 14px 0 18px;
    font-size: 38px;
  }

  .welcome-copy > p {
    font-size: 16px;
  }

  .import-card {
    max-width: 620px;
    margin: 0 auto;
  }

  .workspace {
    padding: 16px 12px;
  }

  .workspace-grid {
    display: block;
    min-height: 0;
  }

  .mobile-panel {
    display: none;
  }

  .mobile-panel.active {
    display: block;
  }

  .sentence-list {
    max-height: none;
  }

  .study-panel.active {
    display: flex;
  }

  .lookup-panel {
    min-height: calc(100vh - 190px);
  }

  .mobile-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 5px 10px env(safe-area-inset-bottom);
    grid-template-columns: repeat(3, 1fr);
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .mobile-nav button {
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
  }

  .mobile-nav button.active {
    color: var(--brand);
    font-weight: 550;
    background: var(--brand-pale);
  }
}

@media (max-width: 480px) {
  .member-menu {
    position: fixed;
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
  }

  .account-records-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 22px 18px;
  }

  .account-record-row,
  .account-record-row.account-record-heading {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .account-record-row.account-record-heading {
    display: none;
  }

  .account-record-amount {
    text-align: left;
  }

  .video-audio-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 22px 18px;
  }

  .video-audio-dialog h2 {
    font-size: 24px;
  }

  .video-audio-file,
  .phone-list-grid.two,
  .phone-list-grid.three,
  .phone-field-grid,
  .video-audio-actions {
    grid-template-columns: 1fr;
  }

  .brand small {
    display: none;
  }

  .welcome h1 {
    font-size: 34px;
  }

  .privacy-note {
    align-items: flex-start;
    line-height: 1.55;
  }

  .import-panel {
    padding: 18px;
  }

  .import-tabs.four {
    grid-template-columns: repeat(2, 1fr);
  }

  .review-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .review-summary-actions,
  .review-rating {
    grid-template-columns: repeat(2, 1fr);
  }

  .review-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-summary-button {
    width: 100%;
  }

  .drop-zone {
    min-height: 190px;
  }

  .focus-card {
    padding: 16px 14px;
  }

  .sentence-text {
    margin-top: 0;
    font-size: 22px;
  }

  .sentence-tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .sentence-tools button {
    padding: 0 8px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* 首次安装：模型选择列表 */
.model-installer-view {
  max-width: 1480px;
  margin: 0 auto;
}

.ai-services-panel > .model-installer-view {
  max-width: none;
  margin: 0;
}

.model-installer-heading {
  display: flex;
  width: 100%;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
}

.model-installer-heading-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.model-installer-heading h2 {
  margin: 4px 0 0;
  color: var(--ink, #333942);
  font-size: 24px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.model-installer-guide {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e9e3e0);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.model-installer-guide-title {
  margin-bottom: 6px;
  color: var(--ink, #333942);
  font-size: 16px;
  font-weight: 550;
}

.model-installer-guide ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  align-items: start;
  gap: 8px 18px;
  margin: 0;
  padding-left: 22px;
}

.model-installer-guide li {
  min-width: 0;
  padding-right: 6px;
}

.model-installer-guide strong {
  color: var(--ink, #333942);
  font-weight: 550;
}

.model-installer-download {
  width: auto;
  flex: 0 0 auto;
  min-width: 180px;
  margin: 0;
  text-align: center;
  text-decoration: none;
}

@media (max-width: 760px) {
  .model-installer-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .model-installer-download {
    width: 100%;
  }

  .model-installer-guide ol {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.model-installer-device,
.model-installer-summary,
.model-installer-group {
  border: 1px solid var(--line, #e9e3e0);
  border-radius: 16px;
  background: #fff;
}

.model-installer-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px 20px;
}

.model-installer-device > div {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: #747b89;
}

.model-installer-device strong {
  flex: 0 0 auto;
  color: #333942;
  font-weight: 550;
}

.model-installer-notice {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  color: #687081;
  background: #fff7f5;
  line-height: 1.7;
}

.model-installer-notice span {
  margin-right: 8px;
  color: #14735d;
  font-weight: 550;
}

.model-installer-groups {
  display: grid;
  gap: 18px;
}

.model-installer-group {
  overflow: hidden;
  padding: 0;
}

.model-installer-group > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line, #e9e3e0);
}

.model-installer-group > header h2 {
  margin: 0 0 7px;
  color: #333942;
  font-size: 23px;
  font-weight: 550;
}

.model-installer-group > header p {
  margin: 0;
  color: #747b89;
  line-height: 1.65;
}

.model-installer-group > header > span {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  color: #cf4b45;
  background: #fff1ef;
  font-size: 14px;
}

.model-installer-models {
  display: grid;
}

.model-installer-model {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 16px;
  min-height: 150px;
  padding: 22px;
  border-bottom: 1px solid var(--line, #e9e3e0);
  cursor: pointer;
}

.model-installer-model:last-child {
  border-bottom: 0;
}

.model-installer-model:hover:not(.incompatible):not(.installed) {
  background: #fffafa;
}

.model-installer-model:has(input:checked) {
  background: #fff4f2;
}

.model-installer-model.incompatible {
  cursor: not-allowed;
  background: #f6f5f4;
  opacity: .62;
}

.model-installer-model.installed {
  cursor: default;
  background: #f3faf7;
}

.model-installer-model > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.model-installer-check {
  display: grid;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  place-items: center;
  border: 1px solid #c9c5c2;
  border-radius: 6px;
  background: #fff;
}

.model-installer-model input:checked + .model-installer-check {
  border-color: #cf4b45;
  background: #cf4b45;
}

.model-installer-model input:checked + .model-installer-check::after {
  width: 9px;
  height: 5px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.model-installer-model input:focus-visible + .model-installer-check {
  outline: 3px solid rgba(207, 75, 69, .18);
  outline-offset: 2px;
}

.model-installer-model-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.model-installer-model-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.model-installer-model-heading strong {
  color: #333942;
  font-size: 20px;
  font-weight: 550;
}

.model-installer-recommended,
.model-installer-fit,
.model-installer-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.25;
}

.model-installer-recommended {
  color: #cf4b45;
  background: #fff0ed;
}

.model-installer-fit.compatible {
  color: #14735d;
  background: #eaf7f1;
}

.model-installer-fit.incompatible {
  color: #747b89;
  background: #ece9e7;
}

.model-installer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-installer-tags span {
  color: #a54641;
  background: #fff5f3;
}

.model-installer-description,
.model-installer-service-alternative,
.model-installer-meta,
.model-installer-incompatible {
  color: #687081;
  line-height: 1.6;
}

.model-installer-service-alternative {
  color: #8b5a52;
  font-size: 14px;
}

.model-installer-meta {
  font-size: 14px;
}

.model-installer-incompatible {
  margin: 0;
  color: #b5403b;
  font-size: 14px;
}

.model-installer-price {
  align-self: center;
  min-width: 126px;
  color: #cf4b45;
  text-align: right;
  white-space: nowrap;
}

.model-installer-summary {
  position: sticky;
  z-index: 4;
  bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 24px;
  margin-top: 20px;
  padding: 18px 20px;
  box-shadow: 0 12px 32px rgba(63, 49, 45, .09);
}

.model-installer-summary-copy {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.model-installer-selected-list {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: #687081;
}

.model-installer-selected-tags {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.model-installer-selected-tag {
  display: inline-flex;
  max-width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 5px 7px 5px 11px;
  color: #333942;
  background: #fff5f3;
  border: 1px solid rgba(207, 75, 69, .2);
  border-radius: 999px;
}

.model-installer-selected-tag > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-installer-selected-tag button {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  padding: 0;
  color: #8a6470;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.model-installer-selected-tag button:hover,
.model-installer-selected-tag button:focus-visible {
  color: #cf4b45;
  background: rgba(207, 75, 69, .08);
}

.model-installer-selected-empty {
  color: #8a909d;
}

.model-installer-total,
.model-installer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
}

.model-installer-actions {
  display: grid;
  width: min(100%, 400px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: center;
  align-items: center;
  gap: 12px;
}

.model-installer-actions .secondary-btn,
.model-installer-actions .primary-btn {
  width: 100%;
  height: 48px;
  min-height: 48px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-width: 1px;
  border-style: solid;
  font-weight: 500;
  line-height: 1;
}

.model-installer-payment {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid rgba(207, 75, 69, .2);
  border-radius: 18px;
  background: linear-gradient(135deg, #fffaf8, #fff);
}

.model-installer-payment[hidden] {
  display: none;
}

.model-installer-payment-copy,
.model-installer-payment-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.model-installer-payment-copy span {
  color: #cf4b45;
  font-size: 14px;
}

.model-installer-payment-copy h3 {
  margin: 4px 0 0;
  color: #303640;
  font-size: 20px;
  font-weight: 600;
}

.model-installer-payment-copy button {
  padding: 8px 12px;
  color: #747b89;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.model-installer-payment > p {
  margin: 10px 0 16px;
  color: #687081;
  line-height: 1.65;
}

.model-installer-payment-body {
  justify-content: flex-start;
}

.model-installer-payment-body .model-payment-qrcode {
  width: 180px;
  min-height: 180px;
  margin: 0;
}

.model-installer-payment-body > div:last-child {
  display: grid;
  gap: 8px;
}

.model-installer-payment-body strong {
  color: #cf4b45;
  font-size: 30px;
  font-weight: 600;
}

.model-installer-payment-body p {
  margin: 0;
  color: #687081;
}

.model-installer-total span {
  color: #687081;
}

.model-installer-total strong {
  color: #333942;
  font-weight: 550;
}

.model-installer-status {
  grid-column: 1 / -1;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  color: #687081;
  background: #fbfaf9;
  border: 1px solid var(--line, #e9e3e0);
  border-radius: 12px;
  line-height: 1.5;
}

.model-installer-status[data-status="error"] {
  color: #c33f39;
  background: #fff3f1;
  border-color: rgba(207, 75, 69, .24);
}

.model-installer-status[data-status="success"] {
  color: #14735d;
  background: #f2faf5;
  border-color: rgba(20, 115, 93, .18);
}

.model-installer-status[data-status="confirm"] {
  color: #9a4a26;
  background: #fff8ed;
  border-color: rgba(154, 74, 38, .18);
}

.model-installer-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  color: #687081;
}

.model-installer-progress[hidden] {
  display: none;
}

.model-installer-progress progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
}

.model-installer-progress progress::-webkit-progress-bar {
  background: #eee9e7;
}

.model-installer-progress progress::-webkit-progress-value {
  background: #cf4b45;
}

.model-installer-progress progress::-moz-progress-bar {
  background: #cf4b45;
}

.model-installer-empty {
  padding: 28px;
  color: #747b89;
}

@media (max-width: 820px) {
  .model-installer-device,
  .model-installer-group > header,
  .model-installer-summary {
    align-items: stretch;
  }

  .model-installer-device,
  .model-installer-group > header {
    flex-direction: column;
  }

  .model-installer-model {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 18px 16px;
  }

  .model-installer-price {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }

  .model-installer-summary {
    position: static;
    grid-template-columns: 1fr;
  }

  .model-installer-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .model-installer-actions {
    grid-template-columns: 1fr;
  }

  .model-installer-payment-body {
    align-items: stretch;
    flex-direction: column;
  }
}

/* 英语精读三栏工作区：紧凑留白、统一选项卡与本地词汇匹配 */
.workspace {
  padding: 16px;
}

.workspace-grid {
  min-height: 0;
  gap: 14px;
}

.panel-heading {
  min-height: 64px;
  padding: 12px;
  gap: 10px;
}

.panel-heading .sentence-panel-title {
  flex: 1;
}

.translation-toggle {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--soft-text);
  background: transparent;
  border: 0;
}

.translation-toggle svg {
  display: block;
  width: 21px;
  height: 21px;
}

.translation-toggle.active,
.translation-toggle:hover {
  color: var(--brand);
}

.sentence-list {
  padding: 6px;
}

.sentence-select {
  padding: 9px 8px;
}

.sentence-heart {
  margin-left: 6px;
  vertical-align: middle;
  transform: translateY(0.08em);
}

.sentence-ending {
  align-items: center;
}

.study-panel {
  gap: 12px;
}

.media-card {
  padding: 12px 14px;
}

.word-token.playing {
  color: var(--brand);
  background: transparent;
  border-radius: 0;
}

.study-tabs-card {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.practice-tabs {
  display: flex;
  flex: 0 0 auto;
  padding: 0 14px;
  gap: 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.practice-tab {
  position: relative;
  min-height: 48px;
  flex: 0 1 auto;
  padding: 0 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.practice-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: transparent;
  border-radius: 999px;
}

.practice-tab.active {
  color: var(--brand);
  font-weight: 500;
  background: transparent;
}

.practice-tab.active::after {
  background: var(--brand);
}

.study-tab-panels {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.study-tab-panel {
  min-height: 100%;
  border: 0;
  border-radius: 0;
}

.focus-card.study-tab-panel,
.practice-card.study-tab-panel {
  padding: clamp(16px, 2vw, 22px);
}

.lookup-panel {
  padding-bottom: 0;
}

.lookup-panel-heading {
  padding: 0 12px 12px;
}

.lookup-tabs {
  display: flex;
  min-height: 48px;
  margin-bottom: 10px;
  align-items: stretch;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.lookup-tab {
  position: relative;
  padding: 0 2px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  background: transparent;
  border: 0;
}

.lookup-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: transparent;
  border-radius: 999px;
}

.lookup-tab.active {
  color: var(--brand);
  font-weight: 500;
}

.lookup-tab.active::after {
  background: var(--brand);
}

.stage-vocab-card,
.phrase-match-card {
  width: 100%;
  min-width: 0;
  padding: 8px 12px 12px;
  background: #fff;
  border: 0;
}

.stage-vocab-heading {
  justify-content: flex-start;
  gap: 8px;
}

.stage-vocab-heading h2 {
  width: 4em;
  min-width: 4em;
  min-height: 44px;
  flex: 0 0 4em;
  font-size: 16px;
  line-height: 1.35;
}

.stage-vocab-heading h2 span {
  display: block;
  white-space: nowrap;
}

.stage-vocab-heading .stage-vocab-select {
  width: auto;
  max-width: calc(100% - 72px);
  height: 44px;
  min-height: 44px;
  flex: 0 1 auto;
  field-sizing: content;
}

.stage-vocab-list,
.phrase-match-list {
  display: grid;
  min-width: 0;
  gap: 0;
}

.stage-vocab-item,
.phrase-match-item {
  display: flex;
  width: 100%;
  min-width: 0;
  padding: 12px 4px;
  align-items: flex-start;
  gap: 8px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.stage-vocab-item:hover,
.stage-vocab-item:focus-visible,
.phrase-match-item:hover {
  background: #fcfaf9;
  border-color: var(--line);
  outline: 0;
}

.stage-vocab-item.expandable {
  cursor: pointer;
}

.stage-vocab-item-heading {
  display: flex;
  min-width: 0;
  align-items: center;
}

.stage-vocab-word {
  display: inline-flex;
  width: auto;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
}

.stage-vocab-word strong {
  font-size: 18px;
}

.stage-vocab-phonetic {
  display: inline;
  color: var(--muted);
  font-size: 17px;
}

.stage-vocab-dictionary {
  margin-top: 3px;
  font-size: 16px;
}

.stage-vocab-definitions {
  margin-top: 0;
}

.stage-vocab-definitions.collapsed .stage-vocab-definition {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.stage-vocab-heart,
.phrase-match-heart {
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.stage-vocab-heart svg,
.phrase-match-heart svg,
.phrase-match-action svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-vocab-heart.saved,
.phrase-match-heart.saved {
  color: var(--brand);
}

.stage-vocab-heart.saved svg,
.phrase-match-heart.saved svg {
  fill: currentColor;
}

.stage-vocab-empty,
.stage-vocab-limit,
.phrase-match-empty {
  margin: 0;
  padding: 18px 6px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  text-align: center;
}

.phrase-match-content {
  min-width: 0;
  flex: 1;
}

.phrase-match-line {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.phrase-match-text {
  color: var(--brand);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
}

.phrase-match-action {
  display: inline-flex;
  width: 1.25em;
  height: 1.25em;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.phrase-match-action:hover {
  color: var(--brand);
}

.phrase-match-translation {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

@media (min-width: 721px) {
  .workspace-grid {
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
  }

  .sentence-panel,
  .study-panel,
  .lookup-panel {
    height: 100%;
    max-height: none;
    align-self: stretch;
  }

  .study-panel {
    min-height: 0;
  }

  .media-card {
    flex: 0 0 auto;
  }

  .media-card video {
    max-height: min(42vh, 430px);
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 12px;
  }

  .workspace-grid {
    height: auto;
  }

  .practice-tabs,
  .lookup-tabs {
    gap: 14px;
  }
}

/* 英语精读工作区字号与阅读节奏：本页统一使用 1.55 倍行距。 */
#workspaceView,
#workspaceView * {
  line-height: 1.55;
}

#workspaceView {
  font-size: 15.5px;
}

#workspaceView .sentence-copy,
#workspaceView .sentence-text,
#workspaceView .stage-vocab-word strong,
#workspaceView .phrase-match-text {
  font-size: 17px;
}

#workspaceView .sentence-translation,
#workspaceView .practice-tab,
#workspaceView .lookup-tab,
#workspaceView .stage-vocab-heading h2,
#workspaceView .stage-vocab-select,
#workspaceView .stage-vocab-empty,
#workspaceView .stage-vocab-limit,
#workspaceView .phrase-match-empty,
#workspaceView .phrase-match-translation,
#workspaceView .media-actions button,
#workspaceView .loop-control,
#workspaceView .sentence-tools button,
#workspaceView .practice-card,
#workspaceView input,
#workspaceView textarea,
#workspaceView select {
  font-size: 15.5px;
}

#workspaceView .sentence-copy small,
#workspaceView .stage-vocab-dictionary,
#workspaceView .stage-vocab-definition {
  font-size: 14.5px;
}

#workspaceView .stage-vocab-phonetic {
  font-size: 15px;
}

#workspaceView .stage-vocab-heading .stage-vocab-select {
  margin-left: auto;
}

/* 英语精读学习卡操作按钮：同一区域统一尺寸、边框和交互反馈。 */
#workspaceView .study-tabs-card .practice-action-button {
  box-sizing: border-box;
  width: 104px;
  min-width: 104px;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--brand);
  background: #fff;
  border: 1px solid rgba(207, 75, 69, 0.28);
  border-radius: 12px;
  box-shadow: none;
  font: inherit;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.35;
}

#workspaceView .study-tabs-card .practice-action-button:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

#workspaceView .study-tabs-card .practice-action-button:focus-visible {
  outline: 3px solid rgba(207, 75, 69, 0.2);
  outline-offset: 2px;
}

#workspaceView .study-tabs-card .practice-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#workspaceView .study-tabs-card .practice-action-button b {
  font: inherit;
}

#workspaceView .study-tabs-card .record-btn.practice-action-button span {
  background: var(--brand);
}

#workspaceView .study-tabs-card .record-btn.practice-action-button:hover span,
#workspaceView .study-tabs-card .record-btn.practice-action-button.recording span {
  background: #fff;
}

#workspaceView .study-tabs-card .record-btn.practice-action-button.recording {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

@media (max-width: 520px) {
  #workspaceView .study-tabs-card .practice-action-button {
    width: calc(50% - 4px);
    min-width: 0;
  }
}
