﻿:root {
  --bg: #f2f2f7;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #007aff;
  --primary-press: #005fcb;
  --highlight-en: #fff3b0;
  --highlight-zh: #d7f8e7;
  --warning: #b45309;
  --ios-font: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--ios-font);
  color: var(--text);
  background:
    radial-gradient(1200px 460px at 8% -12%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(1000px 420px at 100% 0%, #e7f1ff 0%, rgba(231, 241, 255, 0) 55%),
    var(--bg);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(242, 242, 247, 0.72);
  backdrop-filter: blur(10px);
}

.auth-page-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card.solo {
  width: min(92vw, 430px);
}

.auth-card {
  width: min(92vw, 430px);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
  padding: 20px;
}

.auth-brand {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.auth-subtitle {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-tab {
  flex: 1;
  border-radius: 11px;
  background: #eef2ff;
  color: #334155;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-form {
  animation: fadeInUp 0.2s ease;
}

.auth-msg {
  min-height: 20px;
  margin: 2px 0 8px;
  color: #9f1239;
  font-size: 12px;
}

.auth-msg.success {
  color: #0f766e;
}

body.auth-page {
  min-height: 100vh;
  overflow: hidden;
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(860px 500px at 14% 88%, rgba(188, 210, 255, 0.28) 0%, rgba(188, 210, 255, 0) 72%),
    radial-gradient(760px 400px at 86% 14%, rgba(209, 223, 255, 0.24) 0%, rgba(209, 223, 255, 0) 76%),
    linear-gradient(180deg, #fcfbff 0%, #f7f7fd 100%);
}

.auth-page-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-blur {
  position: absolute;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.9;
}

.auth-blur-a {
  width: 460px;
  height: 460px;
  left: -120px;
  bottom: -140px;
  background: radial-gradient(circle, rgba(178, 204, 255, 0.58) 0%, rgba(178, 204, 255, 0) 72%);
}

.auth-blur-b {
  width: 560px;
  height: 320px;
  right: -140px;
  top: 70px;
  background: radial-gradient(circle, rgba(225, 232, 255, 0.68) 0%, rgba(225, 232, 255, 0) 72%);
}

.auth-blur-c {
  width: 260px;
  height: 260px;
  left: 50%;
  top: 18%;
  transform: translateX(-42%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.76) 0%, rgba(255, 255, 255, 0) 72%);
}

.auth-topbar,
.auth-footer,
.editorial-auth {
  position: relative;
  z-index: 1;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 0;
}

.auth-topbar-brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #171717;
}

.auth-help-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 41, 56, 0.82);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(34, 41, 56, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-help-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(34, 41, 56, 0.18);
  background: rgba(22, 28, 39, 0.9);
}

.auth-page-wrap.editorial-auth {
  padding: 48px 24px 112px;
}

.auth-hero {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.auth-hero-title {
  font-size: clamp(60px, 9vw, 76px);
  line-height: 0.94;
  font-weight: 800;
  letter-spacing: -0.065em;
  color: #131313;
}

.auth-card.editorial-card {
  width: min(100%, 372px);
  padding: 22px 24px 26px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 28px 62px rgba(91, 109, 145, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(22px);
}

.auth-glass-tabs {
  gap: 0;
  margin: 0 0 8px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(241, 241, 247, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.auth-glass-tabs .auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #596173;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.auth-glass-tabs .auth-tab.active {
  color: #141414;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.auth-form label {
  display: block;
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #394252;
}

.auth-form > label:first-child {
  margin-top: 0;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: #f2f3f8;
  color: #111827;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.auth-form input::placeholder {
  color: #aab0bc;
}

.auth-form input:focus {
  background: #eef4ff;
  box-shadow: 0 0 0 1.5px rgba(0, 88, 188, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.auth-label-row label {
  margin: 0;
}

.auth-inline-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: #6a8fd2;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.16s ease, color 0.16s ease;
}

.auth-inline-link:hover {
  color: #0058bc;
  background: transparent;
  box-shadow: none;
  transform: scale(1.04);
}

.auth-inline-link:focus,
.auth-inline-link:active {
  background: transparent;
  box-shadow: none;
  transform: scale(1.04);
}

.auth-submit-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #0f6de0 0%, #0058bc 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 30px rgba(0, 88, 188, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 22px 34px rgba(0, 88, 188, 0.26);
}

.auth-submit-btn:disabled {
  opacity: 0.82;
  cursor: wait;
}

.auth-msg {
  min-height: 0;
  margin: 0 0 8px;
}

.auth-msg:empty {
  display: none;
}

.auth-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 34px 28px;
  color: #6f7483;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.auth-footer-copy {
  font-weight: 600;
}

.auth-footer-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.auth-footer-link {
  color: inherit;
  text-decoration: none;
}

.auth-footer-link:hover {
  color: #343b4b;
}

.app-shell {
  height: 100vh;
  width: 100%;
  padding: 20px;
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) 360px;
  gap: 16px;
  overflow: hidden;
}

.app-shell.locked {
  filter: blur(2px) saturate(0.96);
  pointer-events: none;
  user-select: none;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-radius: 24px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.input-panel,
.result-panel,
.glossary-panel {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 128, 0.35) transparent;
}

.input-panel::-webkit-scrollbar,
.result-panel::-webkit-scrollbar,
.glossary-panel::-webkit-scrollbar {
  width: 7px;
}

.input-panel::-webkit-scrollbar-track,
.result-panel::-webkit-scrollbar-track,
.glossary-panel::-webkit-scrollbar-track {
  background: transparent;
}

.input-panel::-webkit-scrollbar-thumb,
.result-panel::-webkit-scrollbar-thumb,
.glossary-panel::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.input-panel::-webkit-scrollbar-thumb:hover,
.result-panel::-webkit-scrollbar-thumb:hover,
.glossary-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.5);
}

.input-panel {
  height: calc(100vh - 40px);
  position: sticky;
  top: 20px;
}

.result-panel,
.glossary-panel {
  height: calc(100vh - 40px);
}

.glossary-panel > .subtitle {
  display: none;
}

h1,
h2,
h3 {
  margin: 0;
}

.subtitle {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

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

.brand h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.brand .theme-toggle-mini {
  margin-left: auto;
  flex-shrink: 0;
}

.user-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 600;
}

.usage-card {
  margin-top: 12px;
  border: 1px solid rgba(191, 219, 254, 0.86);
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7ff 100%);
  border-radius: 16px;
  padding: 10px 12px;
}

.guide-card {
  display: none !important;
}

.guide-mini-btn {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.guide-mini-btn:hover {
  background: #e2e8ff;
  box-shadow: none;
}

.theme-toggle-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  gap: 2px;
}

.theme-toggle-btn {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.theme-toggle-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: inset 0 0 0 1px #dbe2ea;
}

.theme-toggle-btn:hover {
  color: #0f172a;
}

.guide-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.guide-card-head h3 {
  margin: 0;
  font-size: 14px;
}

.guide-steps {
  margin: 8px 0 0;
  padding-left: 20px;
  color: #334155;
  line-height: 1.6;
  font-size: 13px;
}

.usage-text {
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 600;
}

.upgrade-link {
  display: inline-block;
  margin-top: 6px;
  color: #2563eb;
  text-decoration: none;
  font-size: 13px;
}

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

.pay-card {
  text-align: left;
}

.pay-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  margin-bottom: 10px;
}

.pay-title {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 8px;
}

.pay-qr-placeholder {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  min-height: 180px;
  display: grid;
  place-items: center;
  background: #f8fafc;
}

.pay-qr-placeholder img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.pay-tip {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.admin-shell {
  grid-template-columns: minmax(680px, 960px);
  justify-content: center;
}

.admin-wide-shell {
  grid-template-columns: minmax(760px, 1120px);
}

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

.admin-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
}

.usage-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 220px) auto;
  gap: 10px;
  margin-bottom: 12px;
  align-items: end;
}

.usage-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.usage-summary-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}

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

.usage-summary-number {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.usage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.usage-user-head {
  min-width: 0;
  flex: 1;
}

.usage-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 11px;
  background: #eef2ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
}

.usage-meta-line {
  margin-top: 4px;
}

.usage-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.usage-count-box {
  min-width: 120px;
  text-align: center;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 14px;
  padding: 10px 14px;
}

.usage-count-label {
  color: var(--muted);
  font-size: 12px;
}

.usage-count-number {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
}

.usage-detail-btn {
  white-space: nowrap;
}

.usage-plan-btn {
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.usage-plan-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.usage-empty {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
}

.usage-detail-shell {
  grid-template-columns: minmax(860px, 1160px);
}

.usage-detail-grid {
  display: grid;
  gap: 16px;
}

.usage-detail-panel {
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 22px;
  padding: 18px;
  box-shadow:
    0 20px 36px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.usage-detail-simple-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.usage-simple-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 22px;
  padding: 18px;
  box-shadow:
    0 20px 36px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.usage-simple-card-accent {
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.22), transparent 34%),
    rgba(255, 255, 255, 0.84);
  border-color: rgba(191, 219, 254, 0.9);
}

.usage-simple-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.usage-simple-name {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: #0f172a;
}

.usage-simple-count {
  margin-top: 10px;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: #2563eb;
}

.usage-detail-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.usage-chart {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.usage-column-chart {
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 72px));
  justify-content: start;
  gap: 12px;
  align-items: end;
  padding: 12px 10px 6px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.usage-column-item {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.usage-column-top {
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(191, 219, 254, 0.9);
  font-size: 12px;
  color: #2563eb;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
}

.usage-column-track {
  width: 100%;
  min-height: 168px;
  display: flex;
  align-items: end;
  border-radius: 18px;
  background: linear-gradient(180deg, #f1f5f9 0%, #dbeafe 100%);
  padding: 5px;
}

.usage-column-fill {
  width: 100%;
  border-radius: 13px;
  background: linear-gradient(180deg, #7dd3fc 0%, #3b82f6 55%, #2563eb 100%);
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.2);
}

.usage-column-label {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.usage-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 12px;
  padding: 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.usage-heatmap-cell {
  border-radius: 18px;
  padding: 14px 12px;
  border: 1px solid rgba(219, 234, 254, 0.95);
  background: #f8fbff;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.usage-heatmap-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.1);
}

.usage-heatmap-cell[data-level="0"] { background: #f8fafc; border-color: #e2e8f0; }
.usage-heatmap-cell[data-level="1"] { background: #eff6ff; }
.usage-heatmap-cell[data-level="2"] { background: #dbeafe; }
.usage-heatmap-cell[data-level="3"] { background: #bfdbfe; }
.usage-heatmap-cell[data-level="4"] { background: #93c5fd; }
.usage-heatmap-cell[data-level="5"] { background: #60a5fa; color: #fff; border-color: #3b82f6; }

.usage-heatmap-hour {
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  opacity: 0.85;
}

.usage-heatmap-count {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .usage-toolbar {
    grid-template-columns: 1fr;
  }

  .usage-item {
    align-items: stretch;
  }

  .usage-right {
    justify-content: space-between;
    width: 100%;
  }

  .usage-detail-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .usage-heatmap-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .usage-column-chart {
    grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
    gap: 8px;
  }

  .usage-simple-name {
    font-size: 24px;
  }

  .usage-simple-count {
    font-size: 38px;
  }
}

.logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

label {
  display: block;
  margin: 12px 0 8px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: #1f2937;
}

.field-note-label {
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: #8b93a7;
}

textarea,
select,
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfbfd;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  font-family: inherit;
}

textarea:focus,
select:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  background: #ffffff;
  border-color: rgba(0, 122, 255, 0.24);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}

textarea {
  min-height: 164px;
  resize: vertical;
}

.spell-hints {
  margin-top: 8px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}

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

.chip {
  border-radius: 999px;
  padding: 2px 8px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-size: 12px;
}

.chip.bad {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
}

.file-tools-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-tools-row .ghost-btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
  background: #eef2ff;
  color: #334155;
  box-shadow: none;
}

.file-tools-row .ghost-btn:hover {
  background: #e2e8ff;
  box-shadow: none;
}

.file-import-hint {
  margin: 8px 2px 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.file-import-hint.error {
  color: #b91c1c;
}

.primary-btn,
button {
  border: none;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  font-family: inherit;
}

.primary-btn { width: 100%; margin-top: 14px; }

button:hover {
  background: var(--primary-press);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 122, 255, 0.22);
}

button:active { transform: scale(0.98); }

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#status {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-diag-panel {
  margin: 10px 2px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
}

.admin-diag-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.admin-diag-head h3 {
  margin: 0;
  font-size: 12px;
  color: #1e40af;
}

.admin-diag-summary {
  font-size: 11px;
  color: #334155;
}

.admin-diag-bars {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-diag-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #334155;
}

.admin-diag-step {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-diag-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.admin-diag-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8);
}

.admin-diag-count {
  min-width: 34px;
  text-align: right;
  color: #1d4ed8;
  font-weight: 700;
}

.fav-title {
  margin-top: 18px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.library-head {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.library-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #f3f4f9;
  border: 1px solid #e5e7eb;
}

.library-tab {
  min-width: 68px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.library-tab:hover {
  background: #e9edf7;
  color: #334155;
  box-shadow: none;
}

.library-tab.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

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

.fav-section {
  display: grid;
  gap: 8px;
}

.empty-library {
  padding: 14px 12px;
  border: 1px dashed #dbe1ea;
  border-radius: 14px;
  background: #fafbff;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.fav-item {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fav-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.fav-main {
  font-size: 13px;
  font-weight: 600;
}

.fav-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

.fav-left {
  min-width: 0;
}

.fav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.word-state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.fav-rename {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 12px;
  padding: 3px 8px;
  flex-shrink: 0;
}

.fav-delete {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  font-size: 12px;
  padding: 3px 8px;
  flex-shrink: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-bottom-nav {
  display: none;
}

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

.warning {
  color: var(--warning);
  margin: 10px 0 0;
  font-weight: 600;
}

.result-view.hidden {
  display: none;
}

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

.notebook-count {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.notebook-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.notebook-toolbar input,
.notebook-toolbar select {
  margin: 0;
}

.notebook-toolbar input {
  flex: 1;
}

.notebook-toolbar select {
  width: 130px;
}

.notebook-entries {
  display: grid;
  gap: 12px;
}

.notebook-empty {
  margin-top: 6px;
}

.article-tools-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.reading-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.reading-size-control label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #7a8497;
}

.reading-size-control select {
  width: auto;
  min-width: 74px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.export-area { margin-top: 10px; }

.article-title {
  font-size: 23px;
  margin-bottom: 10px;
}

.article-blocks {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.para-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-solid);
  padding: 12px;
  opacity: 0;
  transform: translateY(4px);
  animation: card-fade 0.24s ease forwards;
}

@keyframes card-fade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.para-en,
.para-zh {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.72;
  font-size: 15px;
}

.para-zh {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d1d5db;
  color: #1f2937;
  max-height: 420px;
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.hide-zh .para-zh {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
}

.hide-zh .mixed-note {
  display: none;
}

.hide-zh .para-card.mixed-mode .para-en {
  line-height: 1.72;
}

.export-area.font-small .para-en,
.export-area.font-small .para-zh {
  font-size: 14px;
}

.export-area.font-medium .para-en,
.export-area.font-medium .para-zh {
  font-size: 15px;
}

.export-area.font-large .para-en,
.export-area.font-large .para-zh {
  font-size: 16.5px;
}

mark.vocab-en {
  background: var(--highlight-en);
  border-radius: 5px;
  padding: 0 2px;
}

.mixed-vocab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  vertical-align: baseline;
  margin: 0 1px;
}

.mixed-vocab mark.vocab-en {
  line-height: 1.08;
  font-size: 1.22em;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 6px;
}

.mixed-note {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.1;
  color: #b91c1c;
  font-weight: 600;
  white-space: nowrap;
}

.para-card.mixed-mode .para-en {
  line-height: 2.02;
}

mark.vocab-zh {
  background: var(--highlight-zh);
  border-radius: 5px;
  padding: 0 2px;
}

.sense-marker {
  font-size: 0.68em;
  vertical-align: super;
  line-height: 0;
  margin-left: 1px;
}

.glossary {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-solid);
  padding: 8px 10px;
}

.glossary-item {
  padding: 10px 0;
  border-bottom: 1px dashed #e5e7eb;
  scroll-margin-top: 80px;
}

.glossary-item:last-child { border-bottom: 0; }

.glossary-item.active {
  background: #f9fafb;
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
  border-bottom-color: transparent;
}

.glossary-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  justify-content: space-between;
}

.glossary-word { font-weight: 700; }

.glossary-pos {
  color: #6b7280;
  font-size: 12px;
}

.sense-line,
.extra-line {
  margin: 3px 0;
  color: #1f2937;
  line-height: 1.6;
}

.study-controls {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
}

.mastery-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.mastery-btn {
  min-width: 66px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.mastery-btn:hover {
  background: #e7edf7;
  color: #334155;
  box-shadow: none;
}

.mastery-btn.active {
  background: #eaf3ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.glossary-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #dbe1ea;
}

.glossary-footer-btn {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.glossary-footer-btn:hover:not(:disabled) {
  background: #e2efff;
  box-shadow: none;
}

.head-left {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.speak-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 76px;
  background: #eef2ff;
  color: #1f2937;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  font-size: 11px;
  padding: 4px 8px;
  line-height: 1.12;
}

.speak-label {
  font-weight: 700;
}

.speak-ipa {
  font-size: 10px;
  letter-spacing: 0.01em;
  opacity: 0.9;
}

.head-actions {
  display: flex;
  gap: 6px;
}

.extra-label {
  color: #6b7280;
  font-size: 12px;
  margin-right: 4px;
}

.hidden { display: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.modal.hidden { display: none; }

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ghost-btn {
  background: #eef2ff;
  color: #1f2937;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.preview-paper {
  margin-top: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.preview-paper .para-card,
.preview-paper .glossary-item {
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.modal-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.guide-modal-card {
  width: min(760px, 100%);
}

.guide-modal-content {
  margin-top: 8px;
  padding: 6px 2px;
}

.guide-actions {
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.guide-check-row {
  margin: 0;
  color: #475569;
}

body.reading-mode .input-panel {
  display: none;
}

body.reading-mode .app-shell {
  grid-template-columns: minmax(520px, 1fr) 380px;
}

@media (max-width: 1200px) {
  .app-shell {
    height: auto;
    grid-template-columns: 280px 1fr;
    overflow: visible;
  }

  .glossary-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  body.reading-mode .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  html,
  body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    padding-bottom: 96px;
  }

  .app-shell {
    min-height: calc(100vh - 96px);
    grid-template-columns: 1fr;
    padding: 14px 18px 0;
    overflow: visible;
  }

  .panel {
    overflow: visible;
  }

  .input-panel,
  .result-panel,
  .glossary-panel {
    position: relative;
    top: 0;
    height: auto !important;
    max-height: none !important;
    min-height: auto;
    overflow: visible !important;
    touch-action: pan-y;
    overscroll-behavior: auto;
    padding: 15px 14px 16px;
  }

  .mobile-page-hidden {
    display: none !important;
  }

  .brand h1 {
    font-size: 28px;
  }

  .logo {
    width: 68px;
    height: 68px;
  }

  textarea {
    min-height: 132px;
    font-size: 14px;
  }

  select,
  input[type="text"],
  input[type="password"] {
    font-size: 14px;
  }

  label,
  .quick-row,
  #status,
  .usage-text,
  .upgrade-link,
  .subtitle,
  .field-note-label {
    font-size: 12px;
  }

  .field-note-label {
    line-height: 1.4;
  }

  .primary-btn,
  button {
    font-size: 13px;
  }

  .usage-card {
    padding: 9px 10px;
  }

  .user-row-actions {
    gap: 6px;
  }

  .guide-mini-btn {
    min-height: 26px;
    padding: 3px 9px;
    font-size: 11px;
  }

  .library-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .library-tabs {
    width: 100%;
  }

  .library-tab {
    flex: 1;
    min-width: 0;
  }

  .notebook-view-head {
    flex-direction: column;
    gap: 8px;
  }

  .notebook-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .file-tools-row {
    flex-direction: column;
    align-items: stretch;
  }

  .guide-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-tools-row .ghost-btn {
    width: 100%;
  }

  .notebook-toolbar select {
    width: 100%;
  }

  .top-actions {
    justify-content: flex-start;
    align-items: center;
    gap: 0;
  }

  .top-actions h2 {
    display: none;
  }

  .article-tools-row {
    justify-content: flex-start;
    margin-top: 6px;
    margin-bottom: 2px;
  }

  .reading-size-control label {
    font-size: 11px;
  }

  .reading-size-control select {
    min-width: 66px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .actions {
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

.actions button {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: none;
}

.action-icon {
  width: 16px;
  height: 16px;
  display: block;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-icon-fill {
  fill: currentColor;
  stroke: currentColor;
}

.action-text-icon {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.actions button.is-active {
  background: #eaf3ff;
  color: #0f5fcc;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.actions button.is-active:hover {
  background: #deecff;
}

  #readingModeBtn,
  #favoriteBtn,
  #exportPdfBtn,
  #exportWordBtn {
    width: 34px;
    padding: 0;
    font-size: 14px;
  }

  #toggleZhBtn {
    min-width: 42px;
    padding: 0 10px;
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .para-en,
  .para-zh {
    line-height: 1.58;
  }

  .export-area.font-small .para-en,
  .export-area.font-small .para-zh {
    font-size: 13px;
  }

  .export-area.font-medium .para-en,
  .export-area.font-medium .para-zh {
    font-size: 14px;
  }

  .export-area.font-large .para-en,
  .export-area.font-large .para-zh {
    font-size: 15px;
  }

  .para-zh {
    margin-top: 6px;
    padding-top: 6px;
  }

  .mixed-note {
    font-size: 11px;
  }

  .para-card.mixed-mode .para-en {
    line-height: 1.86;
  }

  .hide-zh .para-card.mixed-mode .para-en {
    line-height: 1.58;
  }

  .mastery-group {
    width: 100%;
  }

  .mastery-btn {
    flex: 1;
    min-width: 0;
  }

  .result-panel,
  .glossary-panel {
    min-height: auto;
  }

  .article-blocks,
  .glossary,
  .favorites-list {
    max-height: none !important;
    overflow: visible !important;
  }

  #resultSection,
  #glossaryPanel {
    scroll-margin-top: 10px;
    scroll-margin-bottom: 92px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  }

  .mobile-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    font-weight: 700;
    min-height: 42px;
  }

  .mobile-nav-btn.active {
    background: #eef6ff;
    border-color: #dbeafe;
    color: #1d4ed8;
  }
}

@media (max-width: 860px) {
  body.auth-page {
    overflow-y: auto;
  }

  .auth-topbar {
    padding: 18px 18px 0;
  }

  .auth-page-wrap.editorial-auth {
    min-height: auto;
    padding: 42px 16px 120px;
  }

  .auth-hero {
    gap: 22px;
  }

  .auth-hero-title {
    font-size: clamp(48px, 16vw, 62px);
  }

  .auth-card.editorial-card {
    width: min(100%, 100%);
    padding: 18px;
    border-radius: 16px;
  }

  .auth-footer {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 18px 22px;
    gap: 12px;
    letter-spacing: 0.1em;
  }

  .auth-footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}

/* Notion-style theme layer */
:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --text: #37352f;
  --muted: #787774;
  --line: #e9e9e7;
  --primary: #0b6bcb;
  --primary-press: #0a5bab;
}

body:not(.auth-page) {
  background: var(--bg) !important;
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body:not(.auth-page) .app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  height: auto;
  min-height: 100vh;
  padding: 18px;
  grid-template-columns: clamp(300px, 20vw, 420px) minmax(0, 1fr) clamp(320px, 22vw, 460px);
  gap: 14px;
  overflow: visible;
}

body:not(.auth-page) .panel {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 8px 24px rgba(15, 15, 15, 0.05);
  backdrop-filter: none;
}

body:not(.auth-page) .input-panel,
body:not(.auth-page) .result-panel,
body:not(.auth-page) .glossary-panel {
  height: calc(100vh - 36px);
  padding: 18px 16px;
}

body:not(.auth-page) .input-panel {
  position: sticky;
  top: 18px;
}

body:not(.auth-page) h1,
body:not(.auth-page) h2,
body:not(.auth-page) h3 {
  color: var(--text);
  letter-spacing: -0.02em;
}

body:not(.auth-page) .brand {
  gap: 0;
}

body:not(.auth-page) .brand h1 {
  font-size: 34px;
  line-height: 0.94;
  font-weight: 800;
  letter-spacing: -0.065em;
  color: #131313;
}

body:not(.auth-page) .subtitle,
body:not(.auth-page) label,
body:not(.auth-page) .field-note-label,
body:not(.auth-page) .usage-text,
body:not(.auth-page) .upgrade-link,
body:not(.auth-page) #status {
  color: var(--muted);
}

body:not(.auth-page) textarea,
body:not(.auth-page) select,
body:not(.auth-page) input[type="text"],
body:not(.auth-page) input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

body:not(.auth-page) textarea::placeholder,
body:not(.auth-page) input::placeholder {
  color: #9b9a97;
}

body:not(.auth-page) textarea:focus,
body:not(.auth-page) select:focus,
body:not(.auth-page) input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 107, 203, 0.15);
}

body:not(.auth-page) button,
body:not(.auth-page) .primary-btn,
body:not(.auth-page) .ghost-btn,
body:not(.auth-page) .library-tab {
  border-radius: 10px;
  font-weight: 600;
}

body:not(.auth-page) button,
body:not(.auth-page) .ghost-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}

body:not(.auth-page) button:hover:not(:disabled),
body:not(.auth-page) .ghost-btn:hover:not(:disabled) {
  background: #f6f6f5;
}

body:not(.auth-page) .primary-btn {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}

body:not(.auth-page) .primary-btn:hover:not(:disabled) {
  background: var(--primary-press);
  border-color: var(--primary-press);
}

body:not(.auth-page) #generateBtn.primary-btn {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

body:not(.auth-page) #generateBtn.primary-btn:hover:not(:disabled) {
  background: #232323;
  border-color: #232323;
}

body:not(.auth-page) .user-badge {
  background: #f6f6f5;
  border: 1px solid var(--line);
  color: #4a4946;
}

body:not(.auth-page) .usage-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfa;
}

body:not(.auth-page) .usage-card .usage-text,
body:not(.auth-page) .usage-card .upgrade-link {
  color: #111111;
}

body:not(.auth-page) .library-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #6b6a66;
}

body:not(.auth-page) .library-tab.active {
  border-color: #d7d7d4;
  background: #f3f3f2;
  color: #2f2e2a;
}

body:not(.auth-page) .actions button {
  min-height: 34px;
}

body:not(.auth-page) .actions button.is-active {
  background: #e9f2ff;
  border-color: #cde2ff;
  color: #0b6bcb;
}

body:not(.auth-page) .article-title {
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.15;
  font-weight: 700;
  color: #2f2e2a;
}

body:not(.auth-page) .para-card {
  border: 1px solid #ececeb;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

body:not(.auth-page) .para-en,
body:not(.auth-page) .para-zh {
  color: var(--text);
}

body:not(.auth-page) .glossary {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

body:not(.auth-page) .glossary-item {
  border-bottom: 1px dashed #ececeb;
}

body:not(.auth-page) .glossary-word {
  color: #2f2e2a;
}

body:not(.auth-page) .glossary-pos {
  color: #8f8d89;
}

body:not(.auth-page) .mobile-bottom-nav {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

body:not(.auth-page) .mobile-nav-btn {
  border: 1px solid transparent;
  color: #6b6a66;
  border-radius: 10px;
}

body:not(.auth-page) .mobile-nav-btn.active {
  color: #2f2e2a;
  background: #f3f3f2;
}

body:not(.auth-page).theme-dark {
  --bg: #171717;
  --panel: #1f1f1f;
  --panel-solid: #1f1f1f;
  --text: #e5e5e5;
  --muted: #a8a8a8;
  --line: #2d2d2d;
  --primary: #4ea1ff;
  --primary-press: #3b8be6;
}

body:not(.auth-page).theme-dark .panel {
  background: #1f1f1f;
  border-color: #2d2d2d;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.28);
}

body:not(.auth-page).theme-dark .brand h1 {
  color: #ffffff;
}

body:not(.auth-page).theme-dark textarea,
body:not(.auth-page).theme-dark select,
body:not(.auth-page).theme-dark input[type="text"],
body:not(.auth-page).theme-dark input[type="password"] {
  background: #171717;
  color: #ececec;
  border-color: #303030;
}

body:not(.auth-page).theme-dark button,
body:not(.auth-page).theme-dark .ghost-btn {
  background: #262626;
  border-color: #3b3b3b;
  color: #eaeaea;
}

body:not(.auth-page).theme-dark .primary-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #0b111a;
}

body:not(.auth-page).theme-dark #generateBtn.primary-btn {
  background: #ffffff;
  border-color: #ffffff;
  color: #0f0f0f;
}

body:not(.auth-page).theme-dark #generateBtn.primary-btn:hover:not(:disabled) {
  background: #ededed;
  border-color: #ededed;
}

body:not(.auth-page).theme-dark button:not(#logoutBtn):hover:not(:disabled) {
  background: #ffffff;
  border-color: #ffffff;
  color: #111111;
}

body:not(.auth-page).theme-dark .usage-card,
body:not(.auth-page).theme-dark .user-badge,
body:not(.auth-page).theme-dark .glossary,
body:not(.auth-page).theme-dark .para-card {
  background: #222;
  border-color: #333;
}

body:not(.auth-page).theme-dark .usage-card .usage-text,
body:not(.auth-page).theme-dark .usage-card .upgrade-link {
  color: #ffffff;
}

body:not(.auth-page).theme-dark .user-badge,
body:not(.auth-page).theme-dark #userBadge {
  color: #ffffff;
}

body:not(.auth-page).theme-dark .favorites-list .fav-item {
  background: #2a2a2a;
  border: 1px solid #7a7a7a;
}

body:not(.auth-page).theme-dark .favorites-list .fav-main,
body:not(.auth-page).theme-dark .favorites-list .fav-meta {
  color: #ffffff;
}

body:not(.auth-page).theme-dark .favorites-list .word-state-pill {
  background: #343434;
  color: #ffffff;
  border-color: #8a8a8a;
}

body:not(.auth-page).theme-dark .library-tab {
  background: #242424;
  color: #d6d6d6;
  border-color: #3b3b3b;
}

body:not(.auth-page).theme-dark .library-tab.active {
  background: #2d2d2d;
  color: #fff;
  border-color: #4a4a4a;
}

body:not(.auth-page).theme-dark .library-tabs {
  background: #d1d5db;
  border-color: #e5e7eb;
}

body:not(.auth-page).theme-dark .article-title {
  color: #ffffff;
}

body:not(.auth-page).theme-dark .mixed-note {
  color: #36f4a4;
}

body:not(.auth-page).theme-dark .glossary .glossary-word,
body:not(.auth-page).theme-dark .glossary .glossary-pos {
  color: #ffffff;
}

body:not(.auth-page).theme-dark .glossary .sense-line,
body:not(.auth-page).theme-dark .glossary .sense-line .sense-marker {
  color: #36f4a4;
}

body:not(.auth-page).theme-dark .glossary .sense-line .vocab-zh {
  background: transparent;
  color: #36f4a4;
  padding: 0;
}

body:not(.auth-page).theme-dark .glossary .extra-line,
body:not(.auth-page).theme-dark .glossary .extra-line .extra-label {
  color: #ffffff;
}

body:not(.auth-page).theme-dark #notebookEntries .glossary-word,
body:not(.auth-page).theme-dark #notebookEntries .glossary-pos,
body:not(.auth-page).theme-dark #notebookEntries .extra-label {
  color: #ffffff;
}

body:not(.auth-page).theme-dark #notebookEntries .sense-line,
body:not(.auth-page).theme-dark #notebookEntries .sense-line .sense-marker,
body:not(.auth-page).theme-dark #notebookEntries .extra-value {
  color: #39ff14;
}

body:not(.auth-page).theme-dark #notebookEntries .sense-line .vocab-zh {
  background: transparent;
  color: #39ff14;
  padding: 0;
}

body:not(.auth-page).theme-dark .glossary-item.active {
  background: #2f2f2f;
}

body:not(.auth-page).theme-dark .theme-toggle-mini {
  border-color: #3b3b3b;
  background: #262626;
}

body:not(.auth-page).theme-dark .theme-toggle-btn {
  color: #a1a1aa;
}

body:not(.auth-page).theme-dark .theme-toggle-btn.is-active {
  background: #171717;
  color: #fff;
  box-shadow: inset 0 0 0 1px #3b3b3b;
}

body:not(.auth-page) #logoutBtn.logout-fx-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #111111;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition-duration: 0.3s;
  box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.15);
  background: #111111;
  color: #ffffff;
  transform: none;
}

body:not(.auth-page) #logoutBtn.logout-fx-btn.hidden {
  display: none !important;
}

body:not(.auth-page) #logoutBtn.logout-fx-btn:hover:not(:disabled) {
  width: 108px;
  border-radius: 40px;
  background: #222222;
  border: 1px solid #222222;
  transform: none;
  box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.15);
}

body:not(.auth-page) #logoutBtn.logout-fx-btn:active {
  transform: translate(2px, 2px);
}

body:not(.auth-page) #logoutBtn.logout-fx-btn:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.35);
  outline-offset: 2px;
}

body:not(.auth-page) #logoutBtn .logout-fx-sign {
  width: 100%;
  transition-duration: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

body:not(.auth-page) #logoutBtn .logout-fx-sign svg {
  width: 15px;
  height: 15px;
}

body:not(.auth-page) #logoutBtn .logout-fx-sign path {
  fill: #ffffff;
}

body:not(.auth-page) #logoutBtn .logout-fx-text {
  position: absolute;
  right: 0;
  width: 0;
  opacity: 0;
  color: #ffffff;
  font-size: 0.94em;
  font-weight: 600;
  white-space: nowrap;
  transition-duration: 0.3s;
  pointer-events: none;
}

body:not(.auth-page) #logoutBtn.logout-fx-btn:hover:not(:disabled) .logout-fx-sign {
  width: 32%;
  padding-left: 14px;
}

body:not(.auth-page) #logoutBtn.logout-fx-btn:hover:not(:disabled) .logout-fx-text {
  opacity: 1;
  width: 68%;
  padding-right: 8px;
}

body:not(.auth-page).theme-dark #logoutBtn.logout-fx-btn {
  background: #f5f5f5;
  color: #111111;
  border: 1px solid #d4d4d8;
  box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.28);
}

body:not(.auth-page).theme-dark #logoutBtn.logout-fx-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: #ffffff;
}

body:not(.auth-page).theme-dark #logoutBtn .logout-fx-sign path {
  fill: #111111;
}

body:not(.auth-page).theme-dark #logoutBtn .logout-fx-text {
  color: #111111;
}

body:not(.auth-page).theme-dark #logoutBtn.logout-fx-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
}

@media (max-width: 1200px) {
  body:not(.auth-page) .app-shell {
    grid-template-columns: 280px 1fr;
  }

  body:not(.auth-page) .glossary-panel {
    grid-column: 1 / -1;
    height: auto;
  }
}

@media (max-width: 860px) {
  body:not(.auth-page) .app-shell {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: calc(100vh - 96px);
    padding: 12px 12px 0;
  }

  body:not(.auth-page) .input-panel,
  body:not(.auth-page) .result-panel,
  body:not(.auth-page) .glossary-panel {
    height: auto !important;
    min-height: auto;
    top: 0;
    padding: 14px 12px 14px;
  }
}

body:not(.auth-page):not(.admin-page).reading-mode .input-panel {
  display: none;
}

body:not(.auth-page):not(.admin-page).reading-mode .app-shell {
  grid-template-columns: clamp(300px, 20vw, 420px) minmax(0, 1fr) clamp(320px, 22vw, 460px);
}

body:not(.auth-page):not(.admin-page).reading-mode .result-panel {
  grid-column: 1 / 3;
}

body:not(.auth-page):not(.admin-page).reading-mode .glossary-panel {
  grid-column: 3 / 4;
}

@media (max-width: 1200px) {
  body:not(.auth-page):not(.admin-page).reading-mode .app-shell {
    grid-template-columns: 280px 1fr;
  }

  body:not(.auth-page):not(.admin-page).reading-mode .result-panel,
  body:not(.auth-page):not(.admin-page).reading-mode .glossary-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  body:not(.auth-page):not(.admin-page).reading-mode .app-shell {
    grid-template-columns: 1fr;
  }
}

body.admin-page .app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100vh;
  height: auto;
  padding: 18px;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  overflow: visible;
}

body.admin-page .admin-shell,
body.admin-page .admin-wide-shell,
body.admin-page .usage-detail-shell {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

body.admin-page .result-panel {
  grid-column: 1 / -1;
}

@media (max-width: 1200px) {
  body:not(.auth-page):not(.admin-page).reading-mode .result-panel {
    grid-column: 1 / -1;
  }

  body:not(.auth-page):not(.admin-page).reading-mode .glossary-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 860px) {
  body.admin-page .app-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-height: calc(100vh - 96px);
    padding: 12px 12px 0;
  }
}

/* Ensure dark-mode hover is white/black for all buttons except logout. */
body:not(.auth-page).theme-dark button:not(#logoutBtn):hover:not(:disabled),
body:not(.auth-page).theme-dark button:not(#logoutBtn).is-active:hover:not(:disabled) {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #111111 !important;
}
