:root {
  --ink: #1c2321;
  --ink-soft: #34403c;
  --muted: #6f7a75;
  --paper: #f6f3ec;
  --card: #ffffff;
  --line: #e7e1d5;
  --line-soft: #efeae0;
  --accent: #0f6b5c;
  --accent-strong: #0a5347;
  --accent-soft: #e4f2ee;
  --accent-mist: #f0f8f6;
  --coral: #c76048;
  --danger: #a93a26;
  --danger-soft: #fbeae6;
  --shadow: 0 28px 70px -34px rgba(28, 35, 33, 0.3);
  --shadow-soft: 0 16px 40px -30px rgba(28, 35, 33, 0.28);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

svg.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid rgba(15, 107, 92, 0.35);
  outline-offset: 2px;
}

/* ---------- 学生端背景与装饰 ---------- */

.student-page {
  /* 红色教育主题：变量只在学生端生效，老师后台保持原配色 */
  --accent: #a31621;
  --accent-strong: #7e0f19;
  --accent-soft: #f6dcd8;
  --accent-mist: #fdf3ef;
  --coral: #c98a2e;
  --ink: #2b1a16;
  --ink-soft: #4a2f2b;
  --muted: #7a5c55;
  --line: #eadac7;
  --card: #fffbf4;

  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  overflow-x: hidden;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(217, 164, 65, 0.14), transparent 62%),
    radial-gradient(760px 460px at 102% 104%, rgba(217, 164, 65, 0.1), transparent 66%),
    linear-gradient(165deg, #8e1b24, #6e1119);
}

.student-page .brand-name {
  color: #fff;
}

.student-page .brand-mark {
  background: #d9a441;
  color: #7e0f19;
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.75);
}

.student-page .card {
  border-color: rgba(126, 15, 25, 0.12);
}

.student-page h1 {
  color: #7e0f19;
}

.student-page .eyebrow {
  color: #a8761f;
}

.student-page .privacy-note {
  color: rgba(255, 255, 255, 0.72);
}

.student-page :focus-visible {
  outline-color: rgba(163, 22, 33, 0.45);
}

.student-shell {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
}

/* ---------- 品牌 ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  box-shadow: 0 10px 22px -12px rgba(15, 107, 92, 0.9);
}

.brand-name {
  font-size: 16px;
}

.brand-tag {
  margin-left: 2px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 107, 92, 0.09);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.student-brand {
  margin-bottom: 26px;
}

/* ---------- 卡片与表单 ---------- */

.card {
  background: var(--card);
  border: 1px solid rgba(28, 35, 33, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.submit-card {
  padding: clamp(28px, 5vw, 42px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(29px, 5vw, 38px);
  line-height: 1.28;
  letter-spacing: -0.025em;
}

.lede {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

textarea {
  display: block;
  width: 100%;
  min-height: 172px;
  resize: vertical;
  padding: 16px 17px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: #fdfcf8;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea::placeholder {
  color: #a8b0ab;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.11);
}

/* ---------- 一人一格 ---------- */

.slot-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 14px;
}

.slot-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
}

.slot-index {
  display: flex;
  align-items: center;
  height: 46px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.slot-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #fdfcf8;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.slot-input::placeholder {
  color: #a8b0ab;
}

.slot-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.11);
}

.slot-remove {
  width: 100%;
  height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.slot-remove:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

.slot-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.slot-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  margin-bottom: 16px;
  padding: 8px 14px;
  border: 1.5px dashed var(--line);
  border-radius: 13px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.slot-add:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-mist);
}

.slot-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.slot-add-icon {
  font-size: 16px;
  line-height: 1;
}

.form-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.form-actions .btn {
  flex: 1;
}

.form-actions .btn-sm {
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  .slot-row {
    grid-template-columns: 104px minmax(0, 1fr) 36px;
    gap: 8px;
  }

  .slot-index {
    font-size: 12.5px;
  }
}

@media (max-width: 360px) {
  .slot-row {
    grid-template-columns: minmax(0, 1fr) 36px;
    grid-template-areas:
      'label remove'
      'input input';
    gap: 6px 8px;
  }

  .slot-index {
    grid-area: label;
    height: auto;
  }

  .slot-input {
    grid-area: input;
  }

  .slot-remove {
    grid-area: remove;
  }
}

.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 9px 2px 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.counter {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-strong);
}

.counter.is-over {
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease,
    transform 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 28px -16px rgba(15, 107, 92, 0.85);
}

.btn-primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  background: #7fa9a0;
  box-shadow: none;
  transform: none;
}

.btn-primary.is-busy svg {
  animation: spin 0.9s linear infinite;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-soft);
  box-shadow: 0 8px 20px -18px rgba(28, 35, 33, 0.5);
}

.btn-secondary:hover {
  border-color: #d5cec0;
  background: #fcfaf5;
}

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

.btn-ghost:hover {
  background: rgba(28, 35, 33, 0.06);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8f2e1c;
}

.btn-danger:disabled {
  background: #c98f84;
}

.btn-danger-ghost {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(169, 58, 38, 0.12);
}

.btn-danger-ghost:hover {
  background: #f6ddd7;
}

.btn-sm {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.btn.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

.btn-block {
  width: 100%;
  min-height: 52px;
  font-size: 15.5px;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--accent-strong);
}

/* ---------- 提交成功 ---------- */

.success-card {
  padding: clamp(30px, 6vw, 46px) clamp(24px, 5vw, 38px);
  text-align: center;
  animation: rise 0.32s ease both;
}

.success-badge {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.success-badge svg {
  width: 30px;
  height: 30px;
}

.success-card h2 {
  margin-bottom: 10px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.success-card h2:focus {
  outline: none;
}

.success-lede {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14.5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.success-card .chips {
  justify-content: center;
  max-height: 190px;
  overflow-y: auto;
  margin-bottom: 18px;
  padding: 2px;
}

.chip {
  display: inline-block;
  max-width: 100%;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chip-more {
  background: #f1ede5;
  color: var(--muted);
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 22px 0 0;
  color: #8b948f;
  font-size: 12.5px;
  text-align: center;
}

.privacy-note .icon {
  width: 14px;
  height: 14px;
}

/* ---------- 确认弹窗 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 8, 12, 0.58);
}

.modal {
  width: min(360px, 100%);
  padding: 26px 24px 22px;
  border: 1px solid rgba(126, 15, 25, 0.14);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 34px 80px -34px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: pop 0.2s ease both;
}

.modal h2 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 21px;
  letter-spacing: -0.01em;
}

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

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- 老师登录 ---------- */

.admin-page {
  min-height: 100vh;
  background: var(--paper);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
  background:
    radial-gradient(760px 460px at 50% -10%, rgba(15, 107, 92, 0.12), transparent 65%),
    var(--paper);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: clamp(28px, 5vw, 38px);
}

.login-brand {
  margin-bottom: 30px;
}

.login-card h1 {
  font-size: 30px;
  margin-bottom: 10px;
}

.login-card .lede {
  margin-bottom: 24px;
  font-size: 14px;
}

.password-field {
  position: relative;
  margin-bottom: 18px;
}

.password-field input {
  width: 100%;
  height: 48px;
  padding: 0 68px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fdfcf8;
  font-size: 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.password-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.11);
}

.text-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.text-button:hover {
  background: var(--accent-soft);
}

.login-help {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.login-help code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f2eee6;
  color: var(--ink-soft);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  word-break: break-all;
}

/* ---------- 后台布局 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background: rgba(246, 243, 236, 0.88);
  border-bottom: 1px solid rgba(28, 35, 33, 0.08);
  backdrop-filter: blur(14px);
}

.brand-sm .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 16px;
}

.topbar .brand-name {
  color: #a31621;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf4f0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.15);
  animation: pulse 3s ease-in-out infinite;
}

.dashboard {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 30px 28px 70px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-head h1 {
  margin-bottom: 6px;
  font-size: clamp(26px, 3.4vw, 34px);
}

.page-head .eyebrow {
  margin-bottom: 8px;
}

.page-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 统计 ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 17px 19px 15px;
  border: 1px solid rgba(28, 35, 33, 0.07);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.stat-card p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stat-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: clamp(25px, 3vw, 31px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  color: #939c97;
  font-size: 11.5px;
}

.stat-card-accent {
  background: linear-gradient(145deg, #117564 0%, #0a4e43 100%);
  border-color: transparent;
}

.stat-card-accent::after {
  content: "";
  position: absolute;
  right: -32px;
  bottom: -44px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.stat-card-accent p {
  color: rgba(255, 255, 255, 0.74);
}

.stat-card-accent .stat-note {
  color: rgba(255, 255, 255, 0.58);
}

/* ---------- 工具栏 ---------- */

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

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(340px, 100%);
  padding: 0 13px;
  height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #9aa39e;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.09);
}

.search-field .icon {
  width: 16px;
  height: 16px;
  color: #8f9993;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
}

.search-field input::placeholder {
  color: #a5ada8;
}

.search-field input::-webkit-search-cancel-button {
  opacity: 0.5;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: #ebe5d9;
}

.segment {
  border: 0;
  border-radius: 9px;
  padding: 7px 15px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 8px -3px rgba(28, 35, 33, 0.25);
}

/* ---------- 面板 ---------- */

.panel {
  padding: 20px 22px 22px;
  border: 1px solid rgba(28, 35, 33, 0.07);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 16.5px;
  letter-spacing: -0.01em;
}

.panel-head span {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 学生词语云 ---------- */

.cloud-panel {
  position: relative;
  margin-bottom: 22px;
  padding-bottom: 12px;
}

.cloud-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.cloud-fullscreen-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #fff;
}

.cloud-fullscreen-btn .icon {
  width: 22px;
  height: 22px;
}

.cloud-panel .icon-collapse {
  display: none;
}

.cloud-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 58px 10px 10px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.cloud-panel.is-fullscreen .word-cloud {
  flex: 1;
  height: auto;
  min-height: 0;
  margin: 0;
}

.cloud-panel.is-fullscreen .empty-state {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 16px;
}

.cloud-panel.is-fullscreen .icon-expand {
  display: none;
}

.cloud-panel.is-fullscreen .icon-collapse {
  display: block;
}

body.is-cloud-fullscreen {
  overflow: hidden;
}

.word-cloud {
  position: relative;
  height: clamp(320px, 46vh, 460px);
  margin-top: 6px;
  overflow: hidden;
}

@keyframes cloud-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.cloud-word {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: default;
  user-select: none;
  animation: cloud-fade 0.32s ease both;
}

.cloud-word.is-center {
  letter-spacing: 0.02em;
  text-shadow: 0 12px 32px rgba(163, 22, 33, 0.16);
}

@media (max-width: 720px) {
  .word-cloud {
    height: clamp(300px, 54vh, 400px);
  }
}

@media (max-width: 560px) {
  .cloud-panel .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ---------- 词语排行 ---------- */

.word-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 4px;
  border-top: 1px solid var(--line-soft);
}

.word-row:first-child {
  border-top: 0;
}

.rank {
  flex: 0 0 30px;
  text-align: center;
  color: #9aa39e;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank-top {
  color: var(--coral);
}

.word-main {
  flex: 1;
  min-width: 0;
}

.word-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
}

.word-text {
  font-size: 14.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.word-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.word-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1ede5;
}

.word-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a31621 0%, #c76048 100%);
  transition: width 0.4s ease;
}

.list-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: #939c97;
  font-size: 12.5px;
  text-align: center;
}

/* ---------- 提交记录 ---------- */

.record-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.record {
  padding: 13px 15px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fdfcf8;
}

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

.record-time {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.record-time time {
  font-weight: 600;
  color: var(--ink-soft);
}

.record-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1ede5;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.record .chips {
  gap: 6px;
}

.record .chip {
  padding: 4px 10px;
  background: var(--accent-mist);
  font-size: 13px;
  font-weight: 500;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #9aa39e;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
}

.empty-state {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- 对话框 ---------- */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px rgba(20, 26, 24, 0.55);
}

dialog[open] {
  animation: pop 0.2s ease both;
}

dialog::backdrop {
  background: rgba(20, 27, 24, 0.46);
  backdrop-filter: blur(3px);
}

.dialog-body {
  padding: 26px 28px 24px;
}

.dialog-body h2 {
  margin-bottom: 10px;
  font-size: 21px;
  letter-spacing: -0.015em;
}

.dialog-body h3 {
  margin-bottom: 14px;
  font-size: 15px;
}

.dialog-body p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.stack {
  display: flex;
  flex-direction: column;
}

.stack .field-label {
  margin-top: 13px;
  margin-bottom: 7px;
}

.text-input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fdfcf8;
  font-size: 14.5px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 107, 92, 0.1);
}

.stack .btn {
  align-self: flex-start;
  margin-top: 4px;
}

.divider {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.danger-zone {
  padding: 16px 17px;
  border: 1px solid rgba(169, 58, 38, 0.14);
  border-radius: 14px;
  background: #fdf7f5;
}

.danger-zone h3 {
  margin-bottom: 6px;
  color: var(--danger);
}

.danger-zone p {
  margin-bottom: 13px;
  font-size: 12.5px;
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-type="error"] {
  background: #8f2e1c;
}

/* ---------- 动画 ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.15);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 160, 107, 0.08);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---------- 响应式 ---------- */

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

@media (max-width: 720px) {
  .topbar {
    padding: 10px 16px;
    gap: 10px;
  }

  .topbar .brand-tag,
  .live-pill {
    display: none;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-actions .btn-text {
    display: none;
  }

  .dashboard {
    padding: 22px 16px 56px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-head > .btn {
    width: 100%;
  }

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

  .search-field {
    width: 100%;
    max-width: none;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }

  .panel {
    padding: 16px 15px;
  }

  .student-page {
    padding: 26px 16px;
  }

  .student-brand {
    margin-bottom: 18px;
  }

  .word-float-a,
  .word-float-c {
    display: none;
  }

  .word-float-b {
    top: 4%;
  }

  .word-float-d {
    bottom: 6%;
  }
}

@media (max-width: 460px) {
  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 14px 15px 13px;
  }

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

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

  .brand-tag {
    display: none;
  }

  .submit-card {
    padding: 26px 22px;
  }

  .success-card {
    padding: 30px 22px;
  }

  .dialog-body {
    padding: 22px 20px 20px;
  }

  .record {
    padding: 12px 12px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
