/* kyapps 内页共用样式（登录 / 注册 / 功能区 / 反馈页；WI-100 v2 + WI-101）
 * 学术简洁、浅色、单列卡片；断点 640px（规格第 8 节）。 */

:root {
  --bg: #FBFAF8;
  --surface: #ffffff;
  --ink: #101B27;
  --ink-soft: #38495A;
  --ink-muted: #6E7C8A;
  --line: #E5E2DB;
  --line-strong: #D8D4CB;
  --accent: #1B4BD8;
  --accent-hover: #143AA8;
  --accent-soft: #EBF1FE;
  --danger: #b42318;
  --danger-soft: #fdf1f0;
  --ok: #1d6b46;
  --ok-soft: #eef7f1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24, 32, 40, 0.04), 0 8px 24px rgba(24, 32, 40, 0.05);
  --font: "PingFang SC", "Microsoft YaHei", "SimHei", sans-serif;
  --serif: "Songti SC", "SimSun", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

img {
  max-width: 100%;
}

/* ---------- 页头 ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}

.brand__logo {
  display: block;
  height: 40px;
  width: auto;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.brand__name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.header-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

/* ---------- WI-105：页头主导航与当前账号 ---------- */

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.site-nav__link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.account {
  min-width: 0;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ---------- 布局 ---------- */

.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.page--auth {
  max-width: 452px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.lede {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: 0.01em;
  font-family: var(--serif);
}

/* ---------- 表单 ---------- */

.form {
  margin: 0;
}

.field {
  margin: 0 0 16px;
}

.field__label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.field__input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field__input::placeholder {
  color: var(--ink-muted);
}

.field__input:hover {
  border-color: var(--ink-muted);
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 75, 216, 0.18);
}

.field__input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field__input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16);
}

.field__error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.45;
}

.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(180, 35, 24, 0.35);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.success-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(29, 107, 70, 0.3);
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 14px;
}

/* ---------- 按钮 ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:focus-visible,
.card-button:focus-visible,
.brand:focus-visible,
.site-nav__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button--primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button--primary:disabled {
  background: #8aa2ba;
  cursor: progress;
}

.button--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 500;
}

.button--ghost:hover {
  border-color: var(--ink-muted);
  background: #fbfbf9;
}

/* ---------- 页脚链接区 ---------- */

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 15px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 3px;
}

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

.text-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 功能区 ---------- */

.hero {
  margin: 8px 0 24px;
}

.hero h1 {
  font-size: 24px;
  font-family: var(--serif);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-button {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: 88px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.card-button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 4px rgba(24, 32, 40, 0.05), 0 12px 28px rgba(24, 32, 40, 0.07);
}

.card-button:active {
  transform: translateY(1px);
}

.card-button__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.card-button__title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.card-button__tag {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.8;
  white-space: nowrap;
}

.card-button__desc {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

/* WI-124：已开放卡片角标（与「即将开放」同一布局，只换配色） */
.card-button__tag--live {
  background: var(--ok-soft);
  color: var(--ok);
}

/* ---------- WI-105：功能说明页状态角标 ---------- */

.feature-status {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.8;
}

/* ---------- WI-101：鉴权状态隐藏（守卫 settle 前不闪现） ---------- */

html[data-auth-state="pending"] .site-header,
html[data-auth-state="pending"] #dashboard-main,
html[data-auth-state="error"] .site-header,
html[data-auth-state="error"] #dashboard-main {
  visibility: hidden;
}

html[data-auth-state="pending"] #feature-main,
html[data-auth-state="error"] #feature-main {
  visibility: hidden;
}

html[data-auth-state="pending"] #polish-main,
html[data-auth-state="error"] #polish-main {
  visibility: hidden;
}

/* ---------- WI-124：论文去 AI 味工具页 ---------- */

.polish-form {
  margin: 20px 0 0;
}

.polish-progress {
  margin: 20px 0 0;
}

.polish-progress progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  accent-color: var(--accent);
}

.polish-result {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.polish-result__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 650;
  font-family: var(--serif);
}

.polish-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.polish-summary__item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
}

.polish-summary dt {
  color: var(--ink-muted);
  font-size: 13px;
}

.polish-summary dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.polish-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
}

.polish-result__actions .button {
  width: auto;
}

@media (max-width: 639px) {
  .polish-summary {
    grid-template-columns: 1fr;
  }

  .polish-result__actions .button {
    width: 100%;
  }
}

/* ---------- WI-101：反馈页 ---------- */

.field__textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

.field__hint {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ---------- WI-101：守卫失败态 ---------- */

.auth-error {
  max-width: 452px;
  margin: 24px auto;
}

.auth-error h1 {
  font-size: 21px;
}

.auth-error p {
  margin: 8px 0;
  color: var(--ink-soft);
  font-size: 15px;
}

/* ---------- 辅助 ---------- */

[hidden] {
  display: none !important;
}

/* ---------- 移动断点 ---------- */

@media (max-width: 639px) {
  .site-header {
    min-height: 64px;
    padding: 12px 16px;
    /* WI-105 规格 10.3：≤639px 页头两行——第一行 品牌 ｜ 导航，第二行 账号 ｜ 退出 */
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .brand__logo {
    height: 32px;
  }

  .brand__name {
    font-size: 16px;
  }

  .card {
    padding: 20px 16px;
  }

  h1 {
    font-size: 23px;
  }

  .hero h1 {
    font-size: 21px;
  }

  .card-button {
    padding: 14px 16px;
  }

  .card-button__head {
    align-items: flex-start;
  }

  .card-button__tag {
    margin-left: 0;
  }

  .button--ghost {
    padding: 10px 14px;
    font-size: 15px;
  }

  .header-action {
    flex: 1 0 100%;
    justify-content: space-between;
  }

  .account {
    max-width: 60%;
  }
}

/* ===== 右下角常驻反馈入口 ===== */
.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  background: #22303B;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(20, 32, 41, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.feedback-fab svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.feedback-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(20, 32, 41, 0.28);
}
.feedback-fab:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
@media (max-width: 480px) {
  .feedback-fab {
    right: 16px;
    bottom: 16px;
    padding: 0 16px;
  }
}

/* ===== WI-109：登录/注册认证页两栏外壳（只作用于 body.auth-page） ===== */
/* 全局规则（.site-header/.page/.page--auth/.card/h1/:root）默认值不改，
 * 认证页需要满宽/去卡片外观时一律在本节内用 .auth-page 作用域覆盖。 */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 57.5fr) minmax(0, 42.5fr);
  min-height: 100vh;
}

/* 左展示区：浅灰蓝底 + 纯 CSS 点阵（无需额外 DOM，点阵不参与读屏） */
.auth-visual {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
  padding: 40px 44px 48px;
  background-color: #edf1f8;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(43, 78, 150, 0.14) 1px, transparent 1.4px),
    radial-gradient(circle at 13px 13px, rgba(43, 78, 150, 0.07) 1px, transparent 1.4px);
  background-size: 26px 26px, 26px 26px;
}

.auth-brand {
  align-self: flex-start;
}

.auth-visual__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: auto 0;
}

.auth-hero {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.auth-lede {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.6;
}

.auth-sample {
  width: 100%;
  max-width: 460px;
  margin: 32px 0 0;
  padding: 20px 22px;
  border: 1px solid rgba(27, 75, 216, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(24, 32, 40, 0.07);
}

.auth-sample__title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.auth-sample__line {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.auth-sample__foot {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(27, 75, 216, 0.1);
  color: var(--ink-muted);
  font-size: 13px;
}

/* 右表单区：白底、左分隔线 + 左向阴影、表单竖直居中 */
.auth-page .page--auth {
  max-width: none;
  margin: 0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 48px 40px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -20px 0 32px -26px rgba(16, 27, 39, 0.28);
}

.auth-page .auth-card {
  width: 100%;
  max-width: 400px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* 控件贴参考页观感：只在认证页作用域覆盖，不动 .field__input/.button 本体 */
.auth-page .field__input {
  border-color: #c5cddb;
}

.auth-page .button--primary {
  border-radius: 10px;
}

/* <960px 单栏：左展示区在上、表单在下；示例卡隐藏，标语副句保留在表单上方 */
@media (max-width: 959px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth-visual {
    gap: 20px;
    padding: 24px 20px 28px;
  }

  .auth-visual__body {
    margin: 0;
  }

  .auth-hero {
    font-size: 26px;
  }

  .auth-lede {
    font-size: 16px;
  }

  .auth-sample {
    display: none;
  }

  .auth-panel {
    display: block;
    padding: 32px 20px 112px;
    border-left: 0;
    box-shadow: none;
  }

  .auth-page .auth-card {
    max-width: 440px;
    margin: 0 auto;
  }
}
/* ===== WI-130：论文去 AI 味工具页（方向 B）===== */
/* 只作用于 body.polish-page / .polish-*；颜色一律复用上方 :root token，不新增色值。 */

body.polish-page .page {
  max-width: 1120px;
  margin: 0 auto;
}

.polish-head {
  margin: 8px 0 24px;
}

.polish-layout {
  display: grid;
  grid-template-columns: minmax(0, 57.5fr) minmax(0, 42.5fr);
  gap: 24px;
  align-items: start;
}

.polish-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.polish-panel__title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 650;
  font-family: var(--serif);
  color: var(--ink);
}

/* ---------- 稿件区：投放区 ---------- */

.polish-dropzone {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.polish-dropzone[data-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.polish-dropzone__input:focus-visible,
.polish-dropzone__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.polish-dropzone__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
}

.polish-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.8;
}

#polish-file-replace {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#polish-file-replace:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

#polish-file-replace:disabled {
  color: var(--ink-soft);
  cursor: not-allowed;
  text-decoration: none;
}

/* ---------- 进度区：四步 stepper ---------- */

.polish-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.polish-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.polish-step__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}

.polish-step__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.polish-step__state {
  font-size: 13px;
  color: var(--ink-soft);
}

.polish-step[data-state="active"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.polish-step[data-state="active"] .polish-step__dot {
  background: var(--accent);
}

.polish-step[data-state="done"] {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.polish-step[data-state="done"] .polish-step__dot {
  background: var(--ok);
}

.polish-step[data-state="done"] .polish-step__state {
  color: var(--ok);
}

.polish-step[data-state="failed"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.polish-step[data-state="failed"] .polish-step__dot {
  background: var(--danger);
}

.polish-step[data-state="failed"] .polish-step__state,
.polish-step[data-state="failed"] .polish-step__label {
  color: var(--danger);
}

.polish-progress {
  margin: 0;
}

#polish-status {
  color: var(--ink-soft);
}

/* ---------- 结果区 ---------- */

.polish-side .polish-result {
  margin: 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- 响应式：<960px 单栏 ---------- */

@media (max-width: 959px) {
  .polish-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .polish-steps {
    gap: 6px;
  }

  .polish-step {
    padding: 8px 2px;
  }

  .polish-step__label {
    font-size: 13px;
  }
}
