/* Lingzo Mobile — 独立样式，勿引用 frontend/ */
:root {
  --bg: #07070c;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --text: #f2f2f7;
  --muted: #9b9bb0;
  --accent: #7c5cff;
  --accent-2: #ff6b9d;
  --accent-soft: rgba(124, 92, 255, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 92, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(255, 107, 157, 0.08), transparent 50%);
  z-index: 0;
}

.m-app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 16px calc(80px + var(--safe-b));
}

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

.m-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.m-brand img { width: 36px; height: 36px; }

.m-brand strong { font-size: 1.05rem; display: block; }

.m-brand span { font-size: 0.72rem; color: var(--muted); }

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

.m-credits-badge {
  border: 1px solid rgba(124, 92, 255, 0.45);
  background: rgba(124, 92, 255, 0.12);
  color: #d4c8ff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.m-hero {
  margin-bottom: 18px;
  padding: 4px 2px 0;
}

.m-hero-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8a8ff;
  font-weight: 700;
}

.m-hero-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.m-analyze-card {
  border: 1px solid rgba(124, 92, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.m-url-hint {
  margin: 8px 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}

.m-url-hint-warn {
  color: #ffb86b;
}

.hidden { display: none !important; }

.btn {
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #b44cf0);
  color: #fff;
  width: 100%;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.btn-secondary:active,
.btn-ghost:active {
  transform: scale(0.98);
  opacity: 0.85;
}

.m-tab:active,
.m-nav button:active {
  opacity: 0.8;
}

.btn:focus-visible,
.m-tab:focus-visible,
.m-nav button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.m-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.45;
}

.m-radar {
  margin-bottom: 14px;
}

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

.m-radar-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.m-radar-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.m-radar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m-radar-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.84rem;
}

.m-radar-rank {
  font-weight: 800;
  color: var(--accent);
  font-size: 0.8rem;
}

.m-radar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-radar-title a {
  color: inherit;
  text-decoration: none;
}

.m-radar-tag {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-radar-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
  white-space: nowrap;
}

.m-radar-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}

.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md, 0 12px 40px rgba(0, 0, 0, 0.35));
}

.m-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.m-tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
}

.m-tab.active {
  background: rgba(124, 92, 255, 0.2);
  border-color: rgba(124, 92, 255, 0.45);
  color: var(--text);
}

.url-input, .file-label {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.file-label {
  display: block;
  text-align: center;
  cursor: pointer;
}

.file-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.m-loading {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.m-loading strong { display: block; color: var(--text); margin-bottom: 6px; }

.m-results h2 { margin: 0 0 8px; font-size: 1.25rem; }

.m-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.m-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: #c4b5fd;
}

.m-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.m-metric {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px;
}

.m-metric .k { font-size: 0.72rem; color: var(--muted); }

.m-metric .v { font-size: 1rem; font-weight: 600; }

.m-prompt {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
}

.m-upsell {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.45;
}

.m-disclaimer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
  opacity: 0.8;
}

.m-warn {
  color: #fbbf24;
  font-size: 0.82rem;
  margin-top: 10px;
}

.m-toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + var(--safe-b));
  transform: translateX(-50%);
  background: #1f1f2e;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

.m-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(7, 7, 12, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 50;
}

.m-nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 8px 4px;
}

.m-nav button.active { color: var(--accent); }

.m-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: end center;
  z-index: 100;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-b));
}

.m-modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 16px 16px 12px 12px;
  padding: 20px;
  border: 1px solid var(--border);
}

.m-modal-card label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 10px 0 4px;
}

.m-modal-card input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.m-error { color: #f87171; font-size: 0.82rem; margin-top: 8px; }

.m-footer-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
}

.m-footer-link a { color: var(--accent); }

.m-footer-legal {
  display: block;
  text-align: center;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.m-footer-legal a { color: var(--accent); }

.m-auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.m-auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
}

.m-auth-tab.active {
  background: rgba(124, 92, 255, 0.2);
  border-color: rgba(124, 92, 255, 0.45);
  color: var(--text);
}

.m-auth-terms {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 10px;
}

.m-auth-terms a { color: var(--accent); }

.m-consent {
  margin-top: 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.m-auth-forgot {
  margin: 8px 0 0;
  font-size: 0.76rem;
  text-align: center;
}

.m-auth-forgot a { color: var(--accent); }

.m-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: underline;
}

.m-modal-card select,
.m-modal-card textarea {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.m-cookie {
  position: fixed;
  bottom: calc(56px + var(--safe-b, 0px));
  left: 12px;
  right: 12px;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(18, 18, 28, 0.96);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

.m-cookie a { color: var(--accent); }
.m-cookie.hidden { display: none; }

.m-verify-banner {
  margin: 0 16px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 180, 80, 0.12);
  border: 1px solid rgba(255, 180, 80, 0.35);
  font-size: 0.76rem;
  text-align: center;
}

.m-verify-banner.hidden { display: none; }

.m-google-wrap { margin-bottom: 10px; }
.m-google-wrap.is-disabled { opacity: 0.45; pointer-events: none; }
.m-auth-divider { text-align: center; font-size: 0.72rem; color: var(--muted); margin: 8px 0; }

.m-purchase-h { font-size: 0.85rem; margin: 12px 0 6px; }
.m-purchase-steps { margin: 0 0 8px 1.1rem; font-size: 0.76rem; color: var(--muted); }
.m-purchase-steps li { margin-bottom: 4px; }
.m-purchase-card { max-height: 85vh; overflow-y: auto; }

.m-install-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: calc(-12px - var(--safe-t)) -16px 12px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(255, 107, 157, 0.12));
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.m-install-banner span { flex: 1; }

.btn-install {
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.m-install-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.m-install-dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  max-width: 320px;
  width: calc(100% - 32px);
  background: var(--surface);
  color: var(--text);
}

.m-install-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.m-install-dialog h3 { margin: 0 0 12px; font-size: 1.05rem; }

.m-install-dialog ol {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.m-install-dialog strong { color: var(--text); }

.m-page-head {
  margin-bottom: 12px;
  padding: 0 2px;
}

.m-page-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.m-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 7, 12, 0.72);
  backdrop-filter: blur(8px);
}

.m-progress-card {
  width: 100%;
  max-width: 360px;
  margin: 0;
  border-color: rgba(124, 92, 255, 0.35);
}

.m-progress-stage {
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.m-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 12px;
}

.m-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #b44cf0);
  transition: width 0.45s ease;
}

.m-progress-tip {
  margin: 0;
  min-height: 2.8em;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

body[data-workspace-state="analyzing"] .m-analyze-card {
  opacity: 0.55;
  pointer-events: none;
}

body[data-workspace-state="report"] .m-hero,
body[data-workspace-state="report"] .m-radar,
body[data-workspace-state="report"] #ai-degree-section {
  display: none;
}

/* ── AI degree realtime + report bar ── */
.m-ai-degree {
  margin-bottom: 14px;
  border-color: rgba(124, 92, 255, 0.22);
  background: linear-gradient(145deg, rgba(124, 92, 255, 0.1), rgba(15, 15, 22, 0.55));
}

.m-ai-degree-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
}

.m-ai-degree-lead {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.m-ai-degree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.m-ai-degree-status {
  min-height: 1.2em;
  margin: 0 0 6px;
  font-size: 0.8rem;
}

.m-ai-degree-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 4px 0 6px;
}

.m-ai-degree-meter {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.m-ai-degree-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent, #7c5cff);
}

.m-ai-degree-unit {
  font-size: 0.8rem;
  color: var(--muted);
}

.m-ai-degree-level {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.m-ai-degree-level-low { color: #7dcea0; border-color: rgba(125, 206, 160, 0.35); }
.m-ai-degree-level-mid { color: #f5c842; border-color: rgba(245, 200, 66, 0.35); }
.m-ai-degree-level-high { color: #ff8a80; border-color: rgba(255, 138, 128, 0.35); }

.m-ai-degree-desc {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.8rem;
}

.m-ai-degree-disclaimer {
  margin: 8px 0 0;
  font-size: 0.72rem;
}

.m-ai-degree-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.28);
}

.m-ai-degree-bar-label {
  font-size: 0.98rem;
  font-weight: 700;
}

.m-ai-degree-bar-hint {
  margin: -4px 0 10px;
  font-size: 0.72rem;
}
