@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  /* Core Colors */
  --bg: #f8fafc;
  --bg-deep: #f1f5f9;
  --panel: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.7);
  --ink: #0f172a;
  --sub: #64748b;
  --line: #e2e8f0;
  --line-light: rgba(226, 232, 240, 0.5);

  /* Brand Colors - More sophisticated orange/indigo mix */
  --accent: #f97316;
  --accent-glow: rgba(249, 115, 22, 0.3);
  --accent-deep: #ea580c;
  --accent-soft: #fff7ed;

  --secondary: #6366f1;
  --secondary-soft: #eef2ff;

  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;

  /* Elevation & Effects */
  --elev-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --elev: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --elev-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius: 16px;
  --radius-xl: 24px;
  --radius-sm: 8px;
  --gap: 16px;
  --blur: blur(12px);
}

.theme-dark,
html.theme-dark {
  --bg: #0f172a;
  --bg-deep: #020617;
  --panel: #1e293b;
  --panel-glass: rgba(30, 41, 59, 0.7);
  --ink: #f8fafc;
  --sub: #94a3b8;
  --line: #334155;
  --line-light: rgba(51, 65, 85, 0.5);
  --accent: #fb923c;
  --accent-glow: rgba(251, 146, 60, 0.2);
  --accent-soft: rgba(251, 146, 60, 0.1);
  --secondary: #818cf8;
  --secondary-soft: rgba(129, 140, 248, 0.1);
}

/* 防止深色模式下页面切换闪烁 (保持这只设定 color-scheme) */
html.theme-dark {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, var(--accent-soft) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, var(--secondary-soft) 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  letter-spacing: 0.01em;
}

/* 酷炫标题渐变 */
.brand-block h1 {
  background: linear-gradient(120deg, #fff 0%, #ffd3bf 30%, #fff 58%, #b4d3ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 220% 220%;
  animation: brandFlow 7s ease-in-out infinite;
  text-shadow: 0 0 24px rgba(255, 171, 140, 0.22);
}

@keyframes brandFlow {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

a {
  color: var(--accent-deep);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: var(--blur);
  background: var(--panel-glass);
  border-bottom: 1px solid var(--line-light);
  padding: 12px 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header .container {
  max-width: 1100px;
  padding-left: 18px;
  padding-right: 18px;
}

.header-top {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--sub);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 18px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  min-height: 58px;
}

.header-main > .brand-block {
  flex-shrink: 0;
  margin-left: 0;
}

.header-main > .user-controls {
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.nav-item {
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sub);
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-deep);
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-logout {
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-logout:hover {
  background: var(--danger);
  color: #fff;
}

.topline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topline select {
  width: auto;
  min-width: 140px;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
}

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

.main-nav-primary {
  align-items: center;
}

.main-nav-secondary {
  padding-top: 8px;
}

.nav-pill {
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--sub);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.nav-pill:hover {
  background: var(--line);
  color: var(--ink);
  transform: translateY(-1px);
}

.nav-pill-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.nav-pill-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-pill-danger {
  background: rgba(213, 57, 57, 0.25);
  border-color: rgba(255, 173, 173, 0.5);
}

.nav-more {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 0 10px 8px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-more summary {
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.84);
  padding: 8px 0 4px;
}

.nav-more[open] {
  background: rgba(255, 255, 255, 0.11);
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

main {
  max-width: 1100px;
  margin: 20px auto 34px;
  padding: 0 16px;
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.15;
}

h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.cards-focus {
  margin-top: 16px;
}

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

.page-header h2 {
  margin: 0;
  font-size: 2rem;
}

.search-filter-belt {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

@media (min-width: 992px) {
  .search-filter-belt {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-bar {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

.search-bar input {
  padding-left: 44px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--sub);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--accent);
  background: var(--bg-deep);
}

.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.word-card {
  padding: 0;
  overflow: hidden;
}

.word-card-top {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.02);
}

.word-card-mid {
  padding: 14px 14px;
}

.word-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.word-title-row .word-title {
  margin: 0;
}

.word-edit-btn {
  flex-shrink: 0;
}

.meta.word-memory-tip {
  margin-top: 6px;
  line-height: 1.5;
  color: #d4380d;
  font-weight: 600;
}

.words-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.words-actions .btn {
  min-height: 40px;
}

.answer-panel summary {
  cursor: pointer;
  padding: 8px 0;
}

.word-card-stats {
  display: flex;
  border-top: 1px solid var(--line-light);
  background: rgba(0, 0, 0, 0.01);
}

.stat-item {
  flex: 1;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid var(--line-light);
}

/* 批量分组面板 */
.batch-assign-panel summary::-webkit-details-marker { display: none; }
.batch-select {
  padding: 5px 8px; border: 1px solid var(--line-light, #d1d5db); border-radius: 8px;
  background: var(--input-bg, #fff); font-size: 0.85rem; min-width: 120px;
}
.batch-input {
  padding: 5px 8px; border: 1px solid var(--line-light, #d1d5db); border-radius: 8px;
  background: var(--input-bg, #fff); font-size: 0.85rem; min-width: 130px;
}
.batch-select:focus, .batch-input:focus { border-color: var(--accent); outline: none; }

.stat-item:last-child {
  border-right: none;
}

.stat-item .val {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
}

.stat-item .lbl {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.mission-card,
.progress,
.study-card {
  margin-top: 16px;
  background: var(--panel);
  padding: 32px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  box-shadow: var(--elev);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.study-card {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  background: linear-gradient(145deg, var(--panel), var(--bg-deep));
}

.study-card h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  word-break: break-word;
  overflow-wrap: break-word;
}

.mission-card {
  margin-top: 0;
  position: relative;
  overflow: hidden;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--panel) 0%, var(--accent-soft) 100%);
  border: 1px solid var(--accent-soft);
  box-shadow: var(--elev-lg);
}

.mission-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: 0;
}

.mission-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -65px;
  top: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 135, 91, 0.3) 0%, rgba(255, 135, 91, 0) 70%);
  pointer-events: none;
}

.mission-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 700;
}

.mission-copy {
  margin: 0;
  max-width: 760px;
  color: var(--sub);
}

.mission-progress {
  margin-top: 12px;
}

.mission-actions {
  margin-top: 14px;
}

.dashboard-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.bar {
  background: var(--line-light);
  border-radius: 9999px;
  height: 12px;
  position: relative;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  border-radius: 9999px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px var(--accent-glow);
}

.btn,
button {
  border: none;
  border-radius: 12px;
  padding: 10px 15px;
  background: linear-gradient(140deg, var(--accent) 0%, #ff7a45 100%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(255, 90, 31, 0.28);
  filter: saturate(1.04);
}

.btn:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 90, 31, 0.18);
}

.btn-primary {
  min-width: 126px;
}

.btn-xl {
  padding: 12px 22px;
  min-width: 170px;
}

.btn-soft,
button.ghost {
  background: #fff;
  color: #2b3443;
  border: 1px solid #d9e0ea;
  box-shadow: none;
}

.btn-soft:hover,
button.ghost:hover {
  box-shadow: 0 4px 12px rgba(20, 28, 41, 0.1);
}

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

.badge-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4f;
  vertical-align: middle;
  margin-left: 6px;
}

.stack label {
  display: block;
  margin-bottom: 20px;
  font-weight: 600;
  color: var(--sub);
}

.stack input,
.stack select {
  margin-top: 8px;
}

.battle-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 45%, #dc2626 100%);
  padding: 48px 32px;
  border-radius: var(--radius-xl);
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.3), 0 2px 8px rgba(220, 38, 38, 0.2);
}

.battle-hero::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.35) 0%, transparent 70%);
  opacity: 0.7;
}

.battle-hero h2 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.battle-hero .meta {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.125rem;
  margin-top: 12px;
}

.battle-stats-link {
  margin-top: 24px;
}

.battle-form {
  margin-top: 20px;
}

.battle-main-cta {
  width: 100%;
  margin-top: 12px;
}

.battle-rooms-table {
  margin-top: 12px;
}

.battle-row-enter {
  min-width: 84px;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #cfd7e4;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.14);
}

.spell-input {
  max-width: 380px;
  font-size: 18px;
  letter-spacing: 0.5px;
  border-width: 1.5px;
  background: #fffdfa;
}

.flash {
  list-style: none;
  margin: 10px 0;
  padding: 0;
}

.flash li {
  background: #fff4e8;
  border: 1px solid #ffddbf;
  color: #63320f;
  padding: 9px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #dde3ec;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  font-size: 13px;
}

th {
  background: #f7f9fd;
  font-weight: 700;
}

.inline-form {
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.quick-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-actions .btn {
  min-height: 40px;
}

.rating {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .rating {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rating button {
  height: 64px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  font-size: 0.875rem;
}

.rating .rating-key {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 2px;
}

.bad {
  background: #c9473f;
}

.good {
  background: #23985f;
}

.meta {
  color: var(--sub);
  font-size: 13px;
}

.auth-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.auth-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  align-items: stretch;
}

.auth-intro {
  background: linear-gradient(135deg, var(--panel), var(--secondary-soft));
  border-color: var(--secondary-soft);
}

.auth-benefits {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.auth-benefits li {
  padding-left: 24px;
  position: relative;
  font-size: 0.9375rem;
  color: var(--sub);
}

.auth-benefits li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.auth-benefits strong {
  color: var(--ink);
  font-weight: 600;
}

.auth-card {
  width: 100%;
  max-width: 470px;
  background: #fff;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid #e1e7ef;
  box-shadow: var(--elev);
}

.auth-card h2 {
  margin: 0 0 7px;
}

.auth-card button {
  margin-top: 4px;
}

.auth-register input,
.auth-login input {
  padding: 11px 12px;
}

.result-pop {
  font-weight: 700;
  margin-top: 10px;
  animation: popIn 0.35s ease;
}

.result-ok {
  color: var(--ok);
}

.result-bad {
  color: var(--danger);
}

@keyframes popIn {
  0% {
    transform: scale(0.86);
    opacity: 0.24;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes revealUp {
  0% {
    transform: translateY(8px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.mission-card,
.cards,
.progress,
.study-card {
  animation: revealUp 0.4s ease both;
}

.round-transition {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn 0.3s ease;
}

.round-transition-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  box-shadow: var(--elev-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.chat-box {
  height: 300px;
  overflow-y: auto;
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-line {
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 12px;
  max-width: 85%;
  align-self: flex-start;
  box-shadow: var(--elev-sm);
  font-size: 0.875rem;
  line-height: 1.4;
  position: relative;
}

.chat-line.mine {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-line.mention {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}

.chat-line strong {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 2px;
  opacity: 0.7;
}

.chat-line .meta {
  font-size: 0.625rem;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
  text-align: right;
}

.mention-tag {
  color: #af5200;
  font-weight: 700;
}

.room-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0;
}

.link-share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.link-share-row span {
  white-space: nowrap;
}

.link-share-row input {
  margin-top: 0;
}

.token-reset-form {
  margin: 0;
  display: inline-flex;
}

.battle-room-head {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 16px;
}

.battle-room-head .link-share-row {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-deep);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.calendar-grid .cell {
  padding: 8px 0;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  background: #f1f4f9;
}

.calendar-grid .lv1 {
  background: #ffd5bf;
}

.calendar-grid .lv2 {
  background: #ffae87;
}

.calendar-grid .lv3 {
  background: #f17846;
  color: #fff;
}

.mcq-card {
  max-width: 760px;
  margin: 18px auto 0;
}

.mcq-title {
  font-size: 28px;
  margin-bottom: 14px;
}

.mcq-options {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
}

.mcq-option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border: 1px solid #d8e0eb;
  border-radius: 12px;
  background: #fff;
  transition: 0.16s ease;
}

.mcq-option:hover {
  border-color: #f2b18f;
  background: #fff8f3;
}

.mcq-option input {
  width: 0;
  height: 0;
  opacity: 0;
  margin: 0;
}

.mcq-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffece2;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.mcq-text {
  color: var(--ink);
}

.mcq-option input:checked+.mcq-badge {
  background: var(--accent);
  color: #fff;
}

.mcq-option:has(input:checked) {
  border-color: var(--accent);
  background: #fff3ec;
  box-shadow: 0 0 0 2px rgba(255, 90, 31, 0.16) inset;
}

.mcq-submit {
  width: 180px;
}

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

/* 手机端提示条 — 默认隐藏，768px 以下才显示 */
.mobile-tip {
  display: none;
}

@media (max-width: 768px) {
  .site-header .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .mobile-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--sub);
    background: var(--accent-soft);
    text-align: center;
  }
  .mobile-tip button {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--sub);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
  }

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

  .container {
    padding: 0 16px;
  }

  .site-header {
    position: sticky;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-main {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* nav-links now handled by hamburger menu CSS below */

  .nav-item {
    min-height: 44px;
    font-size: 1rem;
  }

  .nav-logout {
    min-height: 44px;
    padding: 10px 14px;
  }

  .user-controls {
    gap: 10px;
    flex-wrap: wrap;
  }

  .topline {
    justify-content: flex-start;
    min-width: 0;
  }

  .topline select {
    min-width: 140px;
    max-width: 100%;
  }

  .search-filter-belt {
    gap: 12px;
  }

  .filter-group {
    gap: 10px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-chip {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  .rating {
    grid-template-columns: 1fr 1fr;
  }

  .rating button {
    height: auto;
    min-height: 72px;
    font-size: 1rem;
  }

  .btn,
  button {
    min-height: 44px;
    padding: 12px 16px;
    touch-action: manipulation;
  }

  a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  input,
  textarea,
  select {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 16px;
  }

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

  .inline-form {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .inline-form .btn,
  .inline-form button,
  .inline-form input,
  .inline-form select,
  .inline-form textarea {
    width: 100%;
  }

  .quick-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .quick-actions .btn,
  .quick-actions button {
    width: 100%;
  }

  .battle-hero {
    padding: 28px 18px;
    border-radius: 18px;
  }

  .battle-hero h2 {
    font-size: 1.9rem;
  }

  .battle-hero .meta {
    font-size: 1rem;
  }

  .spell-input {
    max-width: 100%;
    font-size: 18px;
  }

  .mcq-card {
    margin: 14px auto 0;
  }

  .mcq-title {
    font-size: 22px;
    line-height: 1.25;
  }

  .mcq-option {
    grid-template-columns: 40px 1fr;
    padding: 14px 14px;
    min-height: 56px;
  }

  .mcq-badge {
    width: 34px;
    height: 34px;
  }

  .mcq-submit {
    width: 100%;
  }

  .room-meta-line {
    gap: 10px;
  }

  .link-share-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .link-share-row span {
    width: 100%;
  }

  .link-share-row input,
  .link-share-row button {
    width: 100%;
  }

  .battle-room-head {
    padding: 14px;
  }

  .battle-room-head .link-share-row {
    padding: 10px;
  }

  .words-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .words-actions .btn,
  .words-actions .file-import-form,
  .words-actions .file-import-form .btn {
    width: 100%;
  }

  .word-title-row {
    align-items: flex-start;
  }

  .word-edit-btn {
    min-width: 88px;
  }
}

@media (max-width: 540px) {
  .brand-block h1 {
    background-size: 140% 140%;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mission-card,
  .progress,
  .study-card,
  .auth-card {
    padding: 18px;
    border-radius: 14px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-header h2 {
    font-size: 1.6rem;
  }

  .study-card h2 {
    font-size: 2rem;
  }

  .btn-xl {
    width: 100%;
  }

  .main-nav {
    gap: 6px;
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .chat-line {
    max-width: 92%;
  }

  .word-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .word-edit-btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .container {
    padding: 0 14px;
  }

  .nav-item,
  .nav-logout {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .search-bar {
    max-width: 100%;
  }

  .word-card-top {
    padding: 12px 14px;
  }

  .word-card-mid {
    padding: 18px 14px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }
}

/* === V42.8 UI polish === */
.fx-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.fx-blob {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.28;
  animation: floatBlob 14s ease-in-out infinite;
}

.fx-blob.b1 {
  left: 8%;
  top: 18%;
  background: #ffb088;
  animation-delay: 0s;
}

.fx-blob.b2 {
  left: 70%;
  top: 12%;
  background: #a7c7ff;
  animation-delay: -4s;
}

.fx-blob.b3 {
  left: 58%;
  top: 68%;
  background: #ffd7a5;
  animation-delay: -8s;
}

@keyframes floatBlob {

  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  25% {
    transform: translate3d(16px, -12px, 0) scale(1.05);
  }

  50% {
    transform: translate3d(-8px, 14px, 0) scale(0.96);
  }

  75% {
    transform: translate3d(12px, 8px, 0) scale(1.02);
  }
}

.btn,
button {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.45);
  animation: ripple 560ms ease-out;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.page-enter {
  animation: pageIn 320ms ease both;
}

.page-leave {
  animation: pageOut 180ms ease both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes pageOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal-on-scroll.in {
  opacity: 1;
  transform: translateY(0);
}

::selection {
  background: rgba(255, 113, 61, 0.28);
  color: #1f2530;
}

main {
  padding-bottom: 10px;
}

.card,
.mission-card,
.progress,
.study-card,
.auth-card,
table {
  backdrop-filter: saturate(1.08) blur(2px);
}

.card,
.progress,
.study-card,
.auth-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.card:hover,
.progress:hover,
.study-card:hover,
.auth-card:hover {
  transform: translateY(-2px);
  border-color: #c8d4e4;
  box-shadow:
    0 8px 24px rgba(20, 26, 38, 0.09),
    0 0 0 1px rgba(255, 153, 118, 0.12);
}

.nav-pill {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.nav-pill:active,
.btn:active,
button:active {
  transform: translateY(0);
}

.flash {
  max-width: 560px;
  margin: 10px auto;
  padding: 0 16px;
}

.flash li {
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(120, 72, 22, 0.1);
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

.achievement-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(9, 12, 18, 0.45);
  backdrop-filter: blur(4px);
}

.achievement-modal.show {
  display: flex;
}

.achievement-card {
  width: min(92vw, 430px);
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  border: 1px solid #e7edf6;
  box-shadow: 0 24px 60px rgba(10, 16, 27, 0.25);
  animation: popIn 0.3s ease;
}

.achievement-card h3 {
  margin-bottom: 8px;
}

.achievement-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

table {
  border-radius: 16px;
}

tbody tr {
  transition: background 0.16s ease;
}

tbody tr:nth-child(even) {
  background: #fcfdff;
}

tbody tr:hover {
  background: #fff5ef;
}

input,
textarea,
select {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #c2cde0;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #eef2f8;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffc09f 0%, #ff8d5c 100%);
  border-radius: 999px;
  border: 2px solid #eef2f8;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffae84 0%, #ff7a45 100%);
}

/* 主题/动效开关 */
body.theme-dark {
  --bg: #0b111b;
  --panel: #121a27;
  --ink: #e9eef8;
  --sub: #a0aec6;
  --line: #253248;
  --accent: #ff7a45;
  --accent-deep: #ff9a6f;
  --accent-soft: #2a1b16;
  background:
    radial-gradient(60vw 44vh at 100% -20%, #3d2030 0%, transparent 60%),
    radial-gradient(60vw 38vh at -10% 8%, #16243f 0%, transparent 62%),
    #0b111b;
}

body.theme-dark table,
body.theme-dark .auth-card,
body.theme-dark .card,
body.theme-dark .mission-card,
body.theme-dark .progress,
body.theme-dark .study-card {
  background: #121a27;
}

body.theme-dark th {
  background: #1b2638;
}

body.theme-dark tbody tr:nth-child(even) {
  background: #131d2d;
}

body.theme-dark tbody tr:hover {
  background: #1d2738;
}

body.theme-dark .flash li {
  background: #2a1d15;
  border-color: #6d4a37;
  color: #ffd9c6;
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: #101827;
  color: #e6edf7;
  border-color: #2a3750;
}

body.theme-dark .auth-intro {
  background:
    radial-gradient(120% 120% at 95% 5%, rgba(255, 132, 89, 0.18) 0%, transparent 52%),
    linear-gradient(160deg, #152133 0%, #101827 100%);
  border-color: #2d3d58;
}

body.theme-dark .auth-benefits {
  color: #c4d0e4;
}

body.theme-dark .auth-benefits strong {
  color: #eaf1ff;
}

body.motion-off *,
body.motion-off *::before,
body.motion-off *::after {
  animation: none !important;
  transition: none !important;
}

body.motion-off .fx-bg {
  display: none;
}

/* === V42.8 UI 微调 === */

/* 状态标签 */
.state-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.state-badge.state-new {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.state-badge.state-learning {
  background: var(--warn-soft);
  color: var(--warn);
}

.state-badge.state-review {
  background: #eef3ff;
  color: #3b6ecc;
}

.state-badge.state-mastered {
  background: var(--ok-soft);
  color: var(--ok);
}

/* 词库搜索栏 */
.words-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.words-search {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.words-search input[type="text"] {
  flex: 1;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.words-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--sub);
  transition: all 0.16s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.filter-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 分页组件 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.pagination .page-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--sub);
  transition: all 0.16s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.pagination .page-btn:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.pagination .page-btn.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination .page-ellipsis {
  padding: 6px 4px;
  color: var(--sub);
  font-size: 13px;
}

/* 分页带：前后翻页按钮 + 页码信息 */
.pagination-belt {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.pagination-info {
  color: var(--sub);
  font-size: 0.875rem;
}

/* 小尺寸按钮变体 */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
  border-radius: 10px;
}

/* 收藏按钮 */
.fav-btn {
  background: none !important;
  border: none !important;
  cursor: pointer;
  font-size: 1.3em;
  padding: 2px 4px;
  border-radius: 6px;
  transition: transform 0.18s ease, color 0.18s ease;
  color: #ccc;
  line-height: 1;
}

.fav-btn:hover {
  transform: scale(1.2);
  color: var(--accent);
}

.fav-btn.is-fav,
.fav-btn[data-fav="1"] {
  color: var(--accent);
}

/* 表格微调 */
table {
  margin-top: 12px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sub);
  font-weight: 700;
}

td {
  vertical-align: middle;
}

/* 学习页答案面板 */
details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-deep);
  transition: all 0.2s ease;
  list-style: none;
  border: 1px dashed var(--line);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

details[open] summary {
  margin-bottom: 16px;
  background: var(--accent);
  color: #fff;
  border-style: solid;
}

#wordDefinition {
  font-size: 1.25rem;
  color: var(--ink);
  display: block;
  margin: 12px 0;
}

#wordExample {
  font-style: italic;
  padding: 12px;
  background: var(--bg-deep);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 评分按钮 polish */
.rating button {
  padding: 12px 8px;
  font-size: 13px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

.rating .bad {
  background: linear-gradient(140deg, #d94040 0%, #c03524 100%);
}

.rating .bad:hover {
  box-shadow: 0 6px 16px rgba(192, 53, 36, 0.3);
}

.rating .good {
  background: linear-gradient(140deg, #27a866 0%, #1a8a50 100%);
}

.rating .good:hover {
  box-shadow: 0 6px 16px rgba(26, 138, 80, 0.3);
}

/* done 页 science-tip */
.science-tip {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  text-align: left;
  font-size: 0.92em;
  color: #5a3e2a;
  line-height: 1.6;
}

.science-tip strong {
  color: var(--accent-deep);
}

body.theme-dark .science-tip {
  background: #2a1b16;
  color: #e8c9b5;
}

body.theme-dark .science-tip strong {
  color: var(--accent);
}

/* 底部信息行 */
.footer-meta {
  text-align: center;
  margin: 12px 0 20px;
  font-size: 12px;
  color: var(--sub);
  opacity: 0.7;
}

/* 暗色模式补丁 */
body.theme-dark .filter-pill {
  background: #1a2332;
  border-color: #253248;
  color: var(--sub);
}

body.theme-dark .filter-pill:hover {
  background: #2a1b16;
  border-color: var(--accent);
}

body.theme-dark .filter-pill.active {
  background: var(--accent);
  color: #fff;
}

body.theme-dark .page-btn {
  background: #1a2332;
  border-color: #253248;
  color: var(--sub);
}

body.theme-dark .state-badge.state-new {
  background: #2a1b16;
  color: var(--accent);
}

body.theme-dark .state-badge.state-learning {
  background: #2a2410;
  color: #d4a628;
}

body.theme-dark .state-badge.state-review {
  background: #131d30;
  color: #6e9eff;
}

body.theme-dark .state-badge.state-mastered {
  background: #0f2318;
  color: #3dd18c;
}

body.theme-dark .fav-btn {
  color: #3a4760;
}

body.theme-dark .fav-btn:hover,
body.theme-dark .fav-btn.is-fav {
  color: var(--accent);
}

body.theme-dark .science-tip {
  background: #2a1b16;
  color: #e8c9b5;
}

/* 键盘快捷键提示 */
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: "Space Grotesk", monospace;
  background: #f0f3f7;
  border: 1px solid #d1d8e3;
  border-radius: 4px;
  box-shadow: 0 1px 0 #c4ccd8;
  color: var(--ink);
  vertical-align: baseline;
}

body.theme-dark kbd {
  background: #1a2332;
  border-color: #2a3750;
  box-shadow: 0 1px 0 #0f1827;
  color: var(--ink);
}

/* 评分按钮上的快捷键数字 */
.rating-key {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  margin-right: 4px;
  font-weight: 700;
}

/* 表单内联提示 */
.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  min-height: 16px;
  transition: color 0.16s ease;
}

/* ========== 动态交互效果 ========== */

/* --- 1. 答题反馈动画 --- */

/* 答对：弹跳 + 发光 */
@keyframes correctBounce {
  0% {
    transform: scale(1);
  }

  20% {
    transform: scale(1.15);
  }

  40% {
    transform: scale(0.95);
  }

  60% {
    transform: scale(1.05);
  }

  80% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes correctGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 130, 88, 0.4);
  }

  50% {
    box-shadow: 0 0 20px 8px rgba(18, 130, 88, 0.15);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(18, 130, 88, 0);
  }
}

.anim-correct {
  animation: correctBounce 0.5s ease, correctGlow 0.8s ease;
}

/* 答错：抖动 */
@keyframes wrongShake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  50%,
  90% {
    transform: translateX(-6px);
  }

  30%,
  70% {
    transform: translateX(6px);
  }
}

@keyframes wrongFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(192, 53, 36, 0.4);
  }

  50% {
    box-shadow: 0 0 16px 6px rgba(192, 53, 36, 0.15);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(192, 53, 36, 0);
  }
}

.anim-wrong {
  animation: wrongShake 0.5s ease, wrongFlash 0.6s ease;
}

/* 答题结果消息滑入 */
@keyframes resultSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-slide-in {
  animation: resultSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 连击计数器脉冲 */
@keyframes streakPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
    color: var(--accent);
  }

  100% {
    transform: scale(1);
  }
}

.anim-streak-pulse {
  animation: streakPulse 0.4s ease;
}

/* 选择题选项 hover 呼吸灯 */
.mcq-option {
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.mcq-option:hover {
  transform: translateX(4px);
  border-color: #f2b18f;
  background: #fff8f3;
}

.mcq-option:active {
  transform: translateX(2px) scale(0.99);
}

/* 选项选中弹跳 */
.mcq-option:has(input:checked) {
  animation: correctBounce 0.3s ease;
}

/* --- 2. 页面微交互 --- */

/* 导航 pill 悬浮光晕 */
.nav-pill {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-pill:hover {
  transform: translateY(-2px) scale(1.03);
}

.nav-pill:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}

/* 按钮点击缩放 */
.btn:active,
button:active {
  transform: translateY(0) scale(0.96);
  transition-duration: 0.08s;
}

/* 卡片入场错开 */
.cards .card:nth-child(1) {
  animation-delay: 0s;
}

.cards .card:nth-child(2) {
  animation-delay: 0.06s;
}

.cards .card:nth-child(3) {
  animation-delay: 0.12s;
}

.cards .card:nth-child(4) {
  animation-delay: 0.18s;
}

.cards .card {
  animation: revealUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 卡片数字悬浮放大 */
.card p {
  transition: transform 0.2s ease, color 0.2s ease;
}

.card:hover p {
  transform: scale(1.06);
  color: var(--accent-deep);
}

/* 收藏星标点击弹跳 */
.fav-btn {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.fav-btn:active {
  transform: scale(0.8);
}

@keyframes favPop {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.4);
  }

  60% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

.anim-fav-pop {
  animation: favPop 0.35s ease;
}

/* 表格行悬浮指示器 */
tbody tr {
  transition: background 0.2s ease, transform 0.2s ease;
}

tbody tr:hover {
  background: #fff5ef;
  transform: translateX(2px);
}

body.theme-dark tbody tr:hover {
  background: #1d2738;
  transform: translateX(2px);
}

/* Flash 消息入场 */
@keyframes flashSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash li {
  animation: flashSlideDown 0.35s ease both;
}

.flash li:nth-child(2) {
  animation-delay: 0.08s;
}

.flash li:nth-child(3) {
  animation-delay: 0.16s;
}

/* details 展开过渡 */
details[open]> :not(summary) {
  animation: resultSlideIn 0.25s ease both;
}

/* 筛选 pill 切换弹跳 */
.filter-pill {
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-pill:active {
  transform: scale(0.92);
}

/* --- 3. 数据可视化动效 --- */

/* 进度条加载动画 */
@keyframes barLoad {
  0% {
    width: 0;
  }
}

.bar span {
  animation: barLoad 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 进度条光泽流动 */
.bar span::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: barShimmer 2.5s ease-in-out infinite;
}

.bar {
  position: relative;
}

.bar span {
  position: relative;
  overflow: hidden;
}

@keyframes barShimmer {
  0% {
    left: -50%;
  }

  100% {
    left: 150%;
  }
}

/* 数字滚动动画（JS 配合使用） */
@keyframes countUp {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-count-up {
  animation: countUp 0.4s ease both;
}

/* 等级升级特效 */
@keyframes levelUp {
  0% {
    transform: scale(1);
    text-shadow: none;
  }

  25% {
    transform: scale(1.3);
    text-shadow: 0 0 20px rgba(255, 90, 31, 0.6);
  }

  50% {
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(255, 90, 31, 0.3);
  }

  100% {
    transform: scale(1);
    text-shadow: none;
  }
}

.anim-level-up {
  animation: levelUp 0.8s ease;
}

/* 连续打卡火焰效果 */
@keyframes fireGlow {

  0%,
  100% {
    text-shadow: 0 0 4px rgba(255, 90, 31, 0.3);
  }

  50% {
    text-shadow: 0 0 12px rgba(255, 90, 31, 0.6), 0 0 24px rgba(255, 166, 0, 0.2);
  }
}

.streak-fire {
  animation: fireGlow 2s ease-in-out infinite;
  color: var(--accent);
}

/* 成就解锁弹入 */
@keyframes achievementEntrance {
  0% {
    transform: scale(0.6) translateY(20px);
    opacity: 0;
  }

  50% {
    transform: scale(1.05) translateY(-5px);
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.achievement-card {
  animation: achievementEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 日历格子悬浮 */
.calendar-grid .cell {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.calendar-grid .cell:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* MCQ badge 旋转确认 */
@keyframes badgeCheck {
  0% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(10deg) scale(1.15);
  }

  100% {
    transform: rotate(0deg) scale(1);
  }
}

.mcq-option input:checked+.mcq-badge {
  animation: badgeCheck 0.3s ease;
}

/* 评分按钮依次错开入场 */
.rating button:nth-child(1) {
  animation: revealUp 0.3s ease 0.05s both;
}

.rating button:nth-child(2) {
  animation: revealUp 0.3s ease 0.1s both;
}

.rating button:nth-child(3) {
  animation: revealUp 0.3s ease 0.15s both;
}

.rating button:nth-child(4) {
  animation: revealUp 0.3s ease 0.2s both;
}

/* ========== 番茄钟 ========== */

/* 展开态 */
.pomo-widget {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 220px;
  z-index: 9999;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--elev-lg);
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--ink);
}
.pomo-widget.pomo-hidden { display: none; }

.pomo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line-light);
  cursor: move; user-select: none;
}
.pomo-header-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}
.pomo-header-title .pomo-icon { font-size: 14px; }
.pomo-header-btns { display: flex; gap: 2px; }
.pomo-header-btns button {
  background: none !important; border: none !important;
  color: var(--sub); font-size: 15px; cursor: pointer;
  padding: 2px 5px; line-height: 1; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.pomo-header-btns button:hover {
  color: var(--ink); background: var(--bg-deep) !important;
  box-shadow: none; transform: none;
}

.pomo-body { padding: 14px 16px 12px; }

/* 环形进度 */
.pomo-ring-wrap {
  display: flex; justify-content: center;
  margin-bottom: 10px; position: relative;
}
.pomo-ring-svg {
  width: 120px; height: 120px; transform: rotate(-90deg);
}
.pomo-ring-bg { fill: none; stroke: var(--line-light); stroke-width: 5; }
.pomo-ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.pomo-ring-glow {
  fill: none; stroke: var(--accent-glow); stroke-width: 10;
  stroke-linecap: round; filter: blur(4px);
  transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.pomo-time-overlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center;
}
.pomo-time {
  font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink); letter-spacing: 1px;
}
.pomo-status {
  font-size: 10px; color: var(--sub);
  letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px;
}

@keyframes pomoPulse { 0%,100%{opacity:1} 50%{opacity:.7} }
.pomo-widget.pomo-running .pomo-time {
  color: var(--accent); animation: pomoPulse 2s ease-in-out infinite;
}
@keyframes pomoBlink { 0%,100%{opacity:1} 50%{opacity:.35} }
.pomo-widget.pomo-paused .pomo-time {
  color: var(--warn); animation: pomoBlink 1.2s ease-in-out infinite;
}

/* 按钮区 */
.pomo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.pomo-btn {
  padding: 7px 0 !important; border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important; font-size: 11px !important;
  font-weight: 600; cursor: pointer; text-align: center;
  transition: all 0.15s ease; background: var(--bg-deep) !important; color: var(--ink) !important;
}
.pomo-btn-start { background: var(--accent-soft) !important; color: var(--accent-deep) !important; border-color: var(--accent) !important; }
.pomo-btn-start:hover { background: var(--accent) !important; color: #fff !important; box-shadow: none; transform: none; }
.pomo-btn-stop { background: var(--danger-soft) !important; color: var(--danger) !important; border-color: var(--danger) !important; }
.pomo-btn-stop:hover { background: var(--danger) !important; color: #fff !important; box-shadow: none; transform: none; }
.pomo-btn-pause { background: var(--warn-soft) !important; color: var(--warn) !important; border-color: var(--warn) !important; }
.pomo-btn-pause:hover { background: var(--warn) !important; color: #fff !important; box-shadow: none; transform: none; }

/* 统计区 */
.pomo-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0 4px; border-top: 1px solid var(--line-light); }
.pomo-stat { text-align: center; }
.pomo-stat-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pomo-stat-num.stat-done { color: var(--ok); }
.pomo-stat-num.stat-stopped { color: var(--danger); }
.pomo-stat-label { font-size: 10px; color: var(--sub); letter-spacing: 0.05em; }

/* 自动感知 */
.pomo-auto-indicator { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 0 2px; font-size: 10px; color: var(--sub); }
.pomo-auto-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: all 0.3s; }
.pomo-auto-dot.active { background: var(--ok); box-shadow: 0 0 6px var(--ok); animation: autoDotPulse 1.5s ease-in-out infinite; }
@keyframes autoDotPulse { 0%,100%{box-shadow:0 0 3px var(--ok)} 50%{box-shadow:0 0 10px var(--ok)} }

/* === 最小化球 === */
.pomo-mini {
  position: fixed; top: 80px; right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  z-index: 9999; cursor: pointer;
  background: var(--panel); border: 2px solid var(--accent);
  box-shadow: var(--elev);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}
.pomo-mini:hover { transform: scale(1.08); box-shadow: var(--elev-lg); }
.pomo-mini.pomo-hidden { display: none; }

/* 关闭态 FAB */
.pomo-fab {
  position: fixed; bottom: 24px; right: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  z-index: 9999; cursor: pointer;
  background: var(--panel); border: 1.5px solid var(--line);
  box-shadow: var(--elev); color: var(--accent); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  opacity: 0.8;
}
.pomo-fab:hover { transform: scale(1.1); opacity: 1; border-color: var(--accent); box-shadow: var(--elev-lg); }
.pomo-fab.pomo-hidden { display: none; }

.pomo-mini-time { font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.pomo-mini-idle { font-size: 20px; color: var(--accent); }

@keyframes miniOrbit { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
.pomo-mini::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent); border-right-color: var(--secondary);
  opacity: 0; transition: opacity 0.3s;
}
.pomo-mini.pomo-running::before { opacity: 1; animation: miniOrbit 3s linear infinite; }
.pomo-mini.pomo-paused::before { opacity: 1; border-top-color: var(--warn); border-right-color: var(--warn); animation: miniOrbit 4s linear infinite; }

@keyframes borderGlow { 0%,100%{box-shadow:var(--elev-lg)} 50%{box-shadow:var(--elev-lg),0 0 16px var(--accent-glow)} }
.pomo-widget.pomo-running { border-color: var(--accent); animation: borderGlow 3s ease-in-out infinite; }

@keyframes pomoComplete { 0%{box-shadow:0 0 0 0 var(--accent-glow)} 50%{box-shadow:0 0 40px 12px var(--accent-glow)} 100%{box-shadow:var(--elev-lg)} }
.pomo-widget.pomo-complete-flash { animation: pomoComplete 1s ease; }

/* 网格导航 */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
}

.nav-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  background: var(--panel);
  border-radius: 16px;
  text-decoration: none;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  min-height: 80px;
}

.nav-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}

.nav-icon {
  font-size: 28px;
  margin-bottom: 6px;
  display: block;
}

.nav-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.nav-grid-item-danger {
  background: rgba(213, 57, 57, 0.1);
  border-color: rgba(213, 57, 57, 0.3);
}

.nav-grid-item-danger:hover {
  background: rgba(213, 57, 57, 0.2);
  border-color: rgba(213, 57, 57, 0.5);
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .nav-grid-item {
    min-height: 70px;
    padding: 12px 4px;
  }

  .nav-icon {
    font-size: 24px;
  }

  .nav-label {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .nav-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 底部导航栏 */
.nav-tab-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.nav-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 12px;
  transition: all 0.2s;
  flex: 1;
}

.nav-tab-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-tab-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 2px;
}

.nav-tab-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sub);
}

.nav-tab-item.active .nav-tab-label {
  color: var(--accent);
}

.nav-tab-item.active .nav-tab-icon {
  transform: scale(1.1);
}

/* 移动端适配 */
@media (max-width: 600px) {
  .nav-tab-bar {
    padding: 6px 0;
  }

  .nav-tab-item {
    padding: 4px 8px;
  }

  .nav-tab-icon {
    font-size: 20px;
  }

  .nav-tab-label {
    font-size: 10px;
  }
}

/* 内容区域底部留白，避免被导航遮挡 */
main {
  margin-bottom: 70px;
}

/* 顶部导航栏 */
.nav-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.nav-links-two-col {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 100%;
}

.nav-top-item {
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  transition: all 0.2s;
}

.nav-top-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.nav-top-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.nav-logout {
  color: var(--danger);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(213, 57, 57, 0.1);
}

.nav-logout:hover {
  background: rgba(213, 57, 57, 0.2);
}

/* 移动端 */
@media (max-width: 768px) {
  .nav-top-bar {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .nav-links-two-col {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-top-item {
    padding: 4px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

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

  main {
    margin-bottom: 0;
  }
}

/* 学习资产卡片 */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.asset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: all 0.3s ease;
  text-decoration: none;
  overflow: hidden;
  position: relative;
}

.asset-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--elev-lg);
  border-color: var(--accent);
}

.asset-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.asset-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  margin: 4px 0;
}

.asset-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.asset-card-success {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-color: #4caf50;
}

.asset-card-success .asset-value {
  color: #2e7d32;
}

.asset-card-warning {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-color: #ff9800;
}

.asset-card-warning .asset-value {
  color: #ef6c00;
}

.asset-card-info {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border-color: #2196f3;
}

.asset-card-info .asset-value {
  color: #1565c0;
}

@media (max-width: 600px) {
  .assets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 学习资产图表 */
.assets-chart-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}

.assets-chart {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}

.assets-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.legend-label {
  flex: 1;
  font-size: 14px;
  color: var(--sub);
}

.legend-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 600px) {
  .assets-chart-wrapper {
    flex-direction: column;
  }
}

.asset-card-danger {
  background: linear-gradient(135deg, #ffebee, #ffcdd2);
  border-color: #f44336;
}

.asset-card-danger .asset-value {
  color: #c62828;
}

.text-today {
  color: #f44336 !important;
  font-weight: 700;
}

.word-ebb-curve {
  display: flex;
  gap: 2px;
  margin-top: 8px;
}

.ebb-point {
  width: 8px;
  height: 20px;
  background: #e0e0e0;
  border-radius: 2px;
  position: relative;
}

.ebb-point.active {
  background: var(--accent);
}

.ebb-point::after {
  content: attr(data-interval);
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: var(--sub);
}

/* ========== 板块标题 ========== */
.section-title {
  margin: 20px 0 8px;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sub);
}

/* ========== MCQ 答题状态反馈 ========== */
.mcq-option.state-correct {
  border: 2px solid #16a34a !important;
  background: rgba(22, 163, 74, 0.08) !important;
}
.mcq-option.state-wrong {
  border: 2px solid #dc2626 !important;
  background: rgba(220, 38, 38, 0.08) !important;
}
body.theme-dark .mcq-option.state-correct {
  border-color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.1) !important;
}
body.theme-dark .mcq-option.state-wrong {
  border-color: #f87171 !important;
  background: rgba(248, 113, 113, 0.1) !important;
}

/* ========== 首页仪表盘补全样式 ========== */

/* mission-card 内容层：置于伪元素光晕上方 */
.mission-content {
  position: relative;
  z-index: 1;
}

/* 进度数字行（完成进度 xx / xx + 百分比） */
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

/* 卡片标题栏（h3 + 行动按钮同行） */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header h3 {
  margin: 0;
}

/* 徽章行 */
.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  white-space: nowrap;
}

body.theme-dark .badge-tag {
  background: rgba(255, 90, 31, 0.15);
  color: var(--accent);
  border-color: rgba(255, 90, 31, 0.25);
}

/* 统计卡片大数字（带动画计数器） */
.count-num {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 6px 0 4px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* 第二层快捷按钮组（对战/拼写/选择） */
.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ========== 系统级减少动效（无障碍）========== */
@media (prefers-reduced-motion: reduce) {
  body:not(.auth-page) *,
  body:not(.auth-page) *::before,
  body:not(.auth-page) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body:not(.auth-page) .fx-bg {
    display: none;
  }

  body:not(.auth-page) .bar span {
    animation: none !important;
    transition: none !important;
  }
}
/* === 手机端页面布局优化 === */
@media (max-width: 480px) {
  /* 容器调整 */
  .container {
    padding: 12px;
  }
  
  /* 标题字体 */
  h2 {
    font-size: 20px !important;
  }
  
  h3 {
    font-size: 16px !important;
  }
  
  /* 任务卡片 */
  .mission-card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .mission-content h2 {
    font-size: 18px;
    margin: 8px 0;
  }
  
  .mission-copy {
    font-size: 14px;
    line-height: 1.5;
  }
  
  /* 快速操作按钮 */
  .quick-actions {
    margin-top: 16px;
  }
  
  .btn-xl {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  .action-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .action-group .btn {
    padding: 12px 8px;
    font-size: 14px;
  }
  
  /* 数据卡片 */
  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .card {
    padding: 14px 10px;
  }
  
  .card strong {
    font-size: 13px;
  }
  
  .count-num {
    font-size: 28px !important;
    margin: 8px 0;
  }
  
  .meta {
    font-size: 12px;
  }
  
  /* 进度条 */
  .progress {
    padding: 14px;
    margin-bottom: 12px;
  }
  
  .progress-info {
    font-size: 12px;
  }
  
  /* 资产网格 */
  .assets-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .asset-card {
    padding: 12px 8px;
  }
  
  .asset-value {
    font-size: 22px;
  }
  
  .asset-label {
    font-size: 12px;
  }
  
  /* 底部导航栏 */
  .nav-tab-bar {
    padding: 6px 0;
  }
  
  .nav-tab-icon {
    font-size: 20px;
  }
  
  .nav-tab-label {
    font-size: 10px;
  }
  
  /* 输入框 */
  input, textarea, select {
    font-size: 16px !important;
    padding: 12px !important;
  }
  
  /* 表单按钮 */
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  /* 页面区块标题 */
  .section-title h3 {
    font-size: 16px;
    margin: 16px 0 12px;
  }
  
  /* 排行榜 */
  .leaderboard-item {
    padding: 12px 8px;
  }
  
  /* 学习页面 */
  .study-card {
    padding: 16px;
  }
  
  .word-display {
    font-size: 28px !important;
  }
  
  .definition-text {
    font-size: 16px;
  }
  
  /* 选择题选项 */
  .option-btn {
    padding: 14px 12px;
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  /* 词书页面 */
  .book-item {
    padding: 12px;
    margin-bottom: 8px;
  }
  
  /* 聊天/对战房间 */
  .battle-room-container {
    padding: 12px;
  }
  
  .chat-message {
    max-width: 85%;
    padding: 10px 12px;
  }
}

/* 更小屏幕优化 */
@media (max-width: 360px) {
  .cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .action-group {
    grid-template-columns: 1fr;
  }
  
  .btn-xl {
    padding: 12px 16px;
  }
}

/* === Mobile usability enhancements (touch + readability) === */
@media (max-width: 768px) {
  a,
  button,
  .btn,
  input,
  select,
  textarea,
  label {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }

  button,
  .btn,
  .nav-item,
  .nav-top-item,
  .nav-tab-item,
  .filter-chip {
    min-height: 44px;
  }

  .nav-top-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
  }

  .nav-tab-item {
    padding: 8px 10px;
  }

  .nav-grid-item {
    min-height: 84px;
    padding: 14px 8px;
  }
}

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

@media (max-width: 768px) {
  .battle-home-grid {
    gap: 12px;
  }

  .battle-form-card {
    padding: 20px;
  }

  .battle-rooms-card {
    padding: 18px;
  }

  .battle-rooms-table td code {
    font-size: 12px;
  }

  .battle-row-enter {
    min-width: 72px;
  }
}

/* ============================================================
   Mac 简洁浅色 UI 优化 — Apple SF-style (2026)
   ============================================================ */

/* 系统字体 — Mac 上自动用 SF Pro，清晰度更佳 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.7;
}

/* 容器宽度适配 MacBook 14/16 宽屏 */
.container {
  max-width: 1040px;
}

main {
  max-width: 1040px;
  margin: 24px auto 52px;
  padding: 0 28px;
}

/* === Header — Apple 毛玻璃效果 === */
.site-header {
  padding: 8px 0;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: none;
}

body.theme-dark .site-header {
  background: rgba(11, 17, 27, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* === 核心数据卡片 基础样式 === */
.card {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 20px 22px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: block;
  line-height: 1;
}

.card strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* 大数字 */
.card .count-num {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 非 count-num 的 p（等级 Lv.N）*/
.card > p:not(.count-num) {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* 卡片悬浮 */
.card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.12);
}

body.theme-dark .card {
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

body.theme-dark .card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* === Section 标题 === */
.section-title {
  margin: 28px 0 12px;
}

.section-title h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 0;
}

/* === 背景 — 极淡渐变，替换浮动 blob === */
body {
  background:
    radial-gradient(ellipse 70% 35% at 0% 0%, rgba(249, 115, 22, 0.055) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(99, 102, 241, 0.05) 0%, transparent 65%),
    var(--bg);
}

/* === macOS 细滚动条 — 覆盖旧样式 === */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  border: none;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.26);
}

body.theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* === 行间距优化 — Retina 更易读 === */
p,
.meta {
  line-height: 1.65;
}

/* === 更精致的 mission-card 内边距 === */
.mission-card {
  padding: 28px 32px;
}

/* === 仪表盘 grid 间距 === */
.dashboard-grid {
  gap: 14px;
  margin-top: 14px;
}

.cards {
  gap: 14px;
}

/* 今日学习总结卡片 inline style 改用 class */
.today-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.today-summary-item {
  background: var(--bg-deep);
  border-radius: 12px;
  padding: 14px 16px;
}

.today-summary-item .ts-label {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 4px;
}

.today-summary-item .ts-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 3px;
  letter-spacing: -0.02em;
}

.today-summary-item .ts-detail {
  font-size: 12px;
  color: var(--sub);
}

.today-summary-total {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(249, 115, 22, 0.06);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.today-summary-total .ts-total-label {
  font-size: 13px;
  color: var(--sub);
}

.today-summary-total .ts-total-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* 暗色模式今日总结 */
body.theme-dark .today-summary-item {
  background: rgba(255, 255, 255, 0.04);
}

/* === Mac 大屏：两栏排列优化 === */
@media (min-width: 1024px) {
  .cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== Toast 通知系统 ===== */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 360px;
  max-width: 92vw;
}

.toast {
  position: relative;
  background: var(--panel-glass);
  backdrop-filter: saturate(180%) var(--blur);
  -webkit-backdrop-filter: saturate(180%) var(--blur);
  border-radius: var(--radius-xl);
  box-shadow: var(--elev-lg);
  border: 1px solid var(--line-light);
  pointer-events: all;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toast.toast-out {
  animation: toast-out 0.25s ease-in forwards;
}

/* 左侧品牌色竖条 */
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}
.toast-success::before  { background: linear-gradient(180deg, var(--ok), #34d399); }
.toast-farewell::before { background: linear-gradient(180deg, var(--warn), #fcd34d); }
.toast-info::before     { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); }
.toast-edit::before     { background: linear-gradient(180deg, var(--secondary), #a5b4fc); }

/* 类型微底色 — 复用网站的 soft 变量 */
.toast-success  { background: linear-gradient(135deg, var(--ok-soft)       0%, var(--panel-glass) 55%); }
.toast-farewell { background: linear-gradient(135deg, var(--warn-soft)     0%, var(--panel-glass) 55%); }
.toast-info     { background: linear-gradient(135deg, var(--accent-soft)   0%, var(--panel-glass) 55%); }
.toast-edit     { background: linear-gradient(135deg, var(--secondary-soft) 0%, var(--panel-glass) 55%); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.93); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px 11px 18px;
}
.toast-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.toast-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toast-title {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.toast-sub {
  font-size: 12px;
  color: var(--sub);
  line-height: 1.5;
}
.toast-close {
  background: var(--line-light);
  border: none;
  color: var(--sub);
  font-size: 11px;
  cursor: pointer;
  padding: 5px 7px;
  line-height: 1;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}
.toast-close:hover { opacity: 1; background: var(--line); }

/* 进度条 */
.toast-progress-bar {
  height: 2px;
  margin: 0 18px 12px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line-light);
}
.toast-progress-fill {
  display: block;
  height: 100%;
  width: 100%;
  transition: width linear;
  border-radius: 10px;
}
.toast-success  .toast-progress-fill { background: linear-gradient(90deg, var(--ok),       #34d399); }
.toast-farewell .toast-progress-fill { background: linear-gradient(90deg, var(--warn),     #fcd34d); }
.toast-info     .toast-progress-fill { background: linear-gradient(90deg, var(--accent),   var(--accent-deep)); }
.toast-edit     .toast-progress-fill { background: linear-gradient(90deg, var(--secondary), #a5b4fc); }

/* ===== 待复习分组 ===== */
.due-groups-section {
  margin: 0 0 20px;
  background: var(--panel-glass);
  backdrop-filter: saturate(180%) var(--blur);
  -webkit-backdrop-filter: saturate(180%) var(--blur);
  border-radius: var(--radius);
  border: 1px solid var(--line-light);
  box-shadow: var(--elev-sm);
  padding: 16px 20px 18px;
}

.due-groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.due-groups-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #f97316);
}
.due-unit-block {
  margin-bottom: 4px;
}
.due-unit-name {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: 8px;
}
.due-unit-divider {
  height: 1px;
  background: var(--line-light);
  margin: 12px 0;
}
.due-groups-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.due-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.due-group-chip:hover {
  background: rgba(249,115,22,0.12);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--elev-sm), 0 0 0 2px var(--accent-glow);
}
.due-group-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.due-group-badges {
  display: flex;
  gap: 4px;
}
.due-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 100px;
  line-height: 1.5;
}
.due-badge-review {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.due-badge-new {
  background: var(--secondary-soft);
  color: var(--secondary);
}
.due-badge-learning {
  background: var(--ok-soft);
  color: var(--ok);
}

/* ═══ Edit Word Page ═══ */
.ew-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.ew-main {
  flex: 1;
  min-width: 0;
}
.ew-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ew-nav-arrows {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ew-group-section {
  font-size: 0.9em;
  margin-top: 16px;
}
.ew-group-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ew-group-label {
  color: var(--sub);
}
.ew-tag {
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 2px 10px;
  margin-right: 4px;
  font-size: 0.9em;
}
.ew-tag-empty {
  color: var(--sub);
  opacity: 0.6;
}
.ew-prev-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.ew-prev-group-hint {
  color: var(--sub);
  font-size: 0.88em;
}
.ew-prev-group-tag {
  background: var(--secondary-soft);
  border-radius: 6px;
  padding: 2px 10px;
  color: var(--secondary);
  font-size: 0.9em;
}
.ew-same-group-btn {
  color: var(--secondary);
  border-color: var(--secondary-soft);
}
.ew-assign-panel {
  display: none;
  margin-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ew-assign-panel.ew-assign-open {
  display: flex;
}
.ew-select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 0.9em;
  background: var(--panel);
}
.ew-clear-btn {
  color: var(--sub);
}
/* Nearby words panel */
.ew-nearby {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
}
.ew-nearby-title {
  font-size: 0.8em;
  color: var(--sub);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}
.ew-nearby-cols {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.88em;
}
.ew-nearby-col {
  flex: 1;
  min-width: 0;
}
.ew-nearby-header {
  padding: 5px 10px;
  background: var(--bg-deep);
  color: var(--sub);
  font-size: 0.8em;
  border-bottom: 1px solid var(--line);
}
.ew-nearby-link {
  display: block;
  padding: 5px 10px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.15s;
}
.ew-nearby-link:hover {
  background: var(--secondary-soft);
}
.ew-nearby-divider {
  width: 2px;
  background: linear-gradient(to bottom, var(--line), var(--secondary), var(--line));
  flex-shrink: 0;
}
.ew-nearby-empty {
  padding: 8px 10px;
  color: var(--sub);
  opacity: 0.5;
  font-size: 0.85em;
}

@media (max-width: 768px) {
  .ew-layout {
    flex-direction: column;
  }
  .ew-nearby {
    width: 100%;
    position: static;
  }
}

/* ═══ Wrong Book Page ═══ */
.wb-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.wb-module-select {
  width: auto;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 0.875rem;
}
.wb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.wb-card:hover {
  border-color: var(--line);
}
.wb-card-left {
  flex: 1;
  min-width: 0;
}
.wb-word {
  font-weight: 600;
  font-size: 0.95rem;
}
.wb-phonetic {
  font-weight: 400;
  font-size: 0.8em;
  color: var(--sub);
}
.wb-def {
  font-size: 0.85rem;
  color: var(--sub);
  margin-top: 2px;
}
.wb-card-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--sub);
}
.wb-lapses {
  color: var(--danger);
  font-weight: 600;
}
.wb-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--sub);
  font-size: 1.1rem;
}

/* ═══ Public Books Page ═══ */
.pb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.pb-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line-light);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pb-card:hover {
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.pb-card-body {
  margin-bottom: 10px;
}
.pb-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}
.pb-meta {
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--sub);
}
.pb-own-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}
.pb-card-actions {
  display: flex;
  gap: 8px;
}
.pb-copy-form {
  display: inline-block;
}
.pb-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--sub);
  font-size: 1.1rem;
}

/* ═══ Public Book Detail Page ═══ */
.pbd-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.pbd-list {
  border: 1px solid var(--line-light);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.pbd-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-light);
}
.pbd-row:last-child {
  border-bottom: none;
}
.pbd-num {
  flex-shrink: 0;
  width: 28px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--sub);
  opacity: 0.5;
}
.pbd-body {
  flex-shrink: 0;
  min-width: 120px;
}
.pbd-word {
  font-weight: 600;
  font-size: 0.92rem;
}
.pbd-phonetic {
  font-size: 0.78rem;
  color: var(--sub);
  margin-left: 4px;
}
.pbd-def {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--sub);
}

/* ═══ Admin Pages ═══ */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.adm-stat-card {
  background: var(--panel);
  border: 1px solid var(--line-light);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.adm-stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
}
.adm-stat-label {
  font-size: 0.85rem;
  color: var(--sub);
  margin-top: 4px;
}
.adm-stat-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--secondary);
  text-decoration: none;
}
.adm-stat-link:hover {
  text-decoration: underline;
}
.adm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  flex-wrap: wrap;
}
.adm-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.adm-row-id {
  font-size: 0.78rem;
  color: var(--sub);
  opacity: 0.6;
}
.adm-row-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.adm-row-meta {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--sub);
  flex-shrink: 0;
}
.adm-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.adm-row-self {
  font-size: 0.8rem;
  color: var(--sub);
  opacity: 0.5;
}
.adm-badge-admin {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--secondary-soft);
  color: var(--secondary);
  padding: 1px 8px;
  border-radius: 4px;
}
.adm-badge-vis {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-deep);
  color: var(--sub);
  padding: 1px 8px;
  border-radius: 4px;
}
.adm-badge-vis.adm-vis-public {
  background: var(--ok-soft);
  color: var(--ok);
}
.adm-btn-danger {
  color: var(--danger) !important;
  border-color: var(--danger-soft) !important;
}
.adm-btn-danger:hover {
  background: var(--danger-soft) !important;
}

/* ═══ Study Group Picker ═══ */
.study-group-picker {
  margin-bottom: 12px;
}
.study-group-picker > summary {
  cursor: pointer;
  list-style: none;
}
.study-group-picker > summary::-webkit-details-marker { display: none; }
.study-group-units {
  margin-top: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.study-unit-section {
  margin-bottom: 10px;
}
.study-unit-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 4px;
}
.study-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}
.study-group-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  text-decoration: none;
  background: var(--bg-deep);
  color: var(--ink);
  border: 1px solid var(--line-light);
  transition: background 0.15s, border-color 0.15s;
}
.study-group-chip:hover {
  border-color: var(--secondary);
  background: var(--secondary-soft);
}
.study-group-active {
  background: var(--secondary-soft);
  color: var(--secondary);
  border-color: var(--secondary);
  font-weight: 600;
}
.study-group-all {
  color: var(--sub);
}

/* ── groups batch remove ── */
.grp-row-selected {
  background: var(--secondary-soft, #e8f0fe);
  border-radius: 6px;
}

/* ══════════════════════════════════════════════════
   HAMBURGER MENU
   ══════════════════════════════════════════════════ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 200;
}
.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════════
   GROUPS PAGE – desktop layout classes
   ══════════════════════════════════════════════════ */
.grp-mobile-tabs { display: none; }

.grp-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 70vh;
}
.grp-col-left {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.grp-col-mid {
  flex: 1.4;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grp-col-right {
  flex: 1;
  min-width: 280px;
  position: sticky;
  top: 80px;
  align-self: flex-start;
}

/* ══════════════════════════════════════════════════
   LEARNING SUMMARY – desktop layout classes
   ══════════════════════════════════════════════════ */
.ls-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.ls-col-main {
  flex: 1;
  min-width: 0;
}
.ls-col-side {
  width: 300px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 80px;
}

/* Pomo mobile styles moved to main ≤768px block below */

/* ══════════════════════════════════════════════════
   MOBILE: ≤ 768px
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .container {
    padding: 0 14px;
  }
  .header-main > .brand-block {
    position: static;
    transform: none;
    margin: 0;
    text-align: left;
    pointer-events: auto;
    width: auto;
  }

  /* Hamburger visible */
  .hamburger { display: flex; }

  .header-main {
    position: relative;
  }

  /* Nav hidden by default, shown on toggle */
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel, #fff);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--elev);
    padding: 8px;
    z-index: 150;
    gap: 2px;
    max-height: 75vh;
    overflow-y: auto;
  }
  .nav-links.nav-open {
    display: flex;
  }
  .nav-item {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
  }

  /* User controls compact */
  .user-controls {
    flex-wrap: wrap;
  }
  .topline {
    gap: 6px;
  }
  .topline select {
    max-width: 120px;
  }

  /* ── Groups page ── */
  .grp-mobile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    overflow-x: auto;
  }
  .grp-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-sm);
    background: var(--panel, #fff);
    color: var(--sub);
    cursor: pointer;
    white-space: nowrap;
    min-height: auto;
  }
  .grp-tab.active {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
  }

  .grp-layout {
    flex-direction: column;
    min-height: auto;
  }
  .grp-col-left,
  .grp-col-mid,
  .grp-col-right {
    width: 100% !important;
    min-width: 0 !important;
    flex: none;
    position: static;
    max-height: none;
  }
  /* On mobile, hide non-active panels */
  .grp-col-left  { display: flex; }
  .grp-col-mid   { display: none; }
  .grp-col-right { display: none; }
  .grp-col-left.grp-mobile-show,
  .grp-col-mid.grp-mobile-show,
  .grp-col-right.grp-mobile-show {
    display: flex !important;
  }
  .grp-col-left:not(.grp-mobile-show):not(:first-child),
  .grp-col-mid:not(.grp-mobile-show),
  .grp-col-right:not(.grp-mobile-show) {
    display: none !important;
  }

  /* ── Learning summary ── */
  .ls-layout {
    flex-direction: column;
  }
  .ls-col-side {
    width: 100%;
    position: static;
  }
  /* Hide less important table columns */
  .ls-col-hide-mobile { display: none !important; }

  /* ── Settings 2-col grid ── */
  .settings-2col {
    grid-template-columns: 1fr !important;
  }

  /* ── Index today summary grid ── */
  .today-summary-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Words grid ── */
  .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  /* ── Batch assign panel ── */
  .batch-select, .batch-input {
    min-width: 0;
    width: 100%;
  }

  /* ── Public books grid ── */
  .pb-grid {
    grid-template-columns: 1fr;
  }

  /* ── Wrong book cards ── */
  .wb-card {
    flex-direction: column;
    gap: 8px;
  }
  .wb-card-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* ── MCQ submit ── */
  .mcq-submit {
    width: 100%;
  }

  /* ── Spell input ── */
  .spell-input {
    max-width: 100%;
  }

  /* ── Admin rows ── */
  .adm-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .adm-row-main {
    flex: 1;
    min-width: 0;
  }
  .adm-row-meta {
    width: 100%;
    order: 3;
  }
  .adm-row-book {
    width: 100%;
    order: 4;
  }
  .adm-row-actions {
    width: 100%;
    order: 5;
  }

  /* ── Study group picker ── */
  .study-group-picker {
    font-size: 0.85rem;
  }

  /* ── Public book detail ── */
  .pbd-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .pbd-body {
    min-width: 0;
  }
  .pbd-def {
    width: 100%;
    padding-left: 38px;
  }
  .pbd-actions {
    flex-wrap: wrap;
  }

  /* ── Books page table ── */
  .card-section table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Favorites table ── */
  .container > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Pagination ── */
  .pagination-belt {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pagination-belt form {
    width: 100%;
  }

  /* ── Batch assign on words page ── */
  .batch-assign-panel form {
    flex-direction: column;
    align-items: stretch;
  }

  /* ── Wrong book header ── */
  .wb-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Due groups chips ── */
  .due-group-chip {
    width: 100%;
    margin-bottom: 2px;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ══════════════════════════════════════════════════
   MOBILE: ≤ 768px – study page compact
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .study-card {
    padding: 16px !important;
    margin-top: 8px;
    border-radius: 14px;
  }
  .study-card h2 { font-size: 1.8rem; margin-bottom: 2px; }
  .answer-panel { margin-top: 8px; }
  .answer-panel summary { font-size: 0.9rem; padding: 8px 0; }
  .answer-panel p { margin: 6px 0; }
  .rating { margin-top: 12px; gap: 8px; }
  .rating button { height: 52px; font-size: 0.82rem; }

  /* Confidence selector compact */
  .study-card .inline-form { margin-top: 6px !important; gap: 6px; }
  .study-card .inline-form small { display: none; } /* hide "按 S 发音" on mobile */

  /* Study group picker compact */
  .study-group-picker { margin-bottom: 6px; }
  .study-group-units { max-height: 200px; }

  /* Progress bar compact */
  .study-card .bar { max-width: none; }

  /* Mission card compact on mobile */
  .mission-card { padding: 18px; }
  .mission-card h2 { font-size: 1.2rem; }
  .mission-copy { font-size: 0.85rem; }
  .mission-progress { margin-top: 10px; }
  .mission-actions { margin-top: 10px; }

  /* Index cards compact */
  .cards { gap: 8px; margin-top: 10px; }
  .card { padding: 12px; }
  .card-icon { font-size: 1.2rem; }
  .card .count-num { font-size: 1.3rem; }

  /* Pomo: mobile bottom bar mode */
  .pomo-widget {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 50vh;
    overflow-y: auto;
  }
  .pomo-body { padding: 10px 14px 14px; }
  .pomo-ring-wrap { margin: 0 auto; }
  .pomo-ring-svg { width: 90px !important; height: 90px !important; }
  .pomo-time { font-size: 1rem !important; }
  .pomo-status { font-size: 0.7rem; }
  .pomo-actions { gap: 6px; margin-top: 8px; }
  .pomo-btn { padding: 6px 12px !important; font-size: 0.75rem !important; }
  .pomo-stats { margin-top: 6px; }
  .pomo-auto-indicator { font-size: 0.7rem; margin-top: 4px; }

  .pomo-mini {
    width: 44px; height: 44px;
    bottom: 12px; right: 12px;
    top: auto !important;
  }
  .pomo-mini-time { font-size: 11px; }
  .pomo-fab {
    bottom: 12px !important; right: 12px !important;
    width: 44px !important; height: 44px !important;
  }
}

/* ══════════════════════════════════════════════════
   MOBILE: ≤ 480px (small phones)
   ══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .brand-block h1 { font-size: 1.2rem; }
  .brand-eyebrow { font-size: 0.65rem; }

  /* Study page extra compact */
  .study-card { padding: 12px !important; }
  .study-card h2 { font-size: 1.5rem; }
  .answer-panel p { font-size: 0.9rem; }
  .rating { gap: 6px; }
  .rating button { height: 46px; font-size: 0.8rem; }

  /* Rating buttons 2x2 */
  .rating {
    grid-template-columns: 1fr 1fr;
  }

  /* Shrink cards */
  .cards { gap: 6px; }
  .card { padding: 10px; }
  .card .count-num { font-size: 1.2rem; }
  .card strong { font-size: 0.78rem; }
  .card .meta { font-size: 0.7rem; }

  /* Words grid - single column */
  .words-grid {
    grid-template-columns: 1fr !important;
  }

  /* Footer meta */
  .footer-meta { font-size: 0.75rem; padding: 0 14px; }

  /* Admin rows stacked */
  .adm-row-actions {
    flex-wrap: wrap;
  }
  .adm-row-actions .btn {
    flex: 1;
    text-align: center;
    min-width: 0;
  }
}

/* ══════════════════════════════════════════════════
   Admin: book selector in user management
   ══════════════════════════════════════════════════ */
.adm-row-book {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.adm-book-select {
  padding: 4px 8px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--ink);
  font-size: 0.82rem;
  max-width: 200px;
  min-height: 32px;
  transition: border-color 0.3s;
}
.adm-book-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ══════════════════════════════════════════════════
   BATTLE HISTORY – card-based layout
   ══════════════════════════════════════════════════ */
.bh-rank-list { display: flex; flex-direction: column; gap: 4px; }
.bh-rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-deep); border-radius: 8px;
}
.bh-rank-pos {
  font-weight: 700; font-size: 0.9rem;
  width: 28px; text-align: center; color: var(--sub);
}
.bh-rank-name { flex: 1; font-weight: 500; }
.bh-rank-elo { font-weight: 700; color: var(--accent); }

.bh-match-list { display: flex; flex-direction: column; gap: 8px; }
.bh-match-card {
  display: block; text-decoration: none; color: var(--ink);
  padding: 12px 14px;
  background: var(--bg-deep); border: 1px solid var(--line-light);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.bh-match-card:hover { border-color: var(--secondary); }
.bh-match-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.bh-match-code { font-size: 0.85rem; font-weight: 600; }
.bh-match-result { font-size: 0.82rem; font-weight: 600; }
.bh-win { color: var(--ok); }
.bh-lose { color: var(--danger); }
.bh-draw { color: var(--sub); }
.bh-match-players { font-size: 0.9rem; margin-bottom: 4px; }
.bh-match-bottom { display: flex; justify-content: space-between; align-items: center; }
.bh-match-score { font-weight: 700; font-size: 1rem; }

/* ══════════════════════════════════════════════════
   BATTLE ROOMS – card-based layout
   ══════════════════════════════════════════════════ */
.br-room-list { display: flex; flex-direction: column; gap: 8px; }
.br-room-card {
  display: block; text-decoration: none; color: var(--ink);
  padding: 12px 14px;
  background: var(--bg-deep); border: 1px solid var(--line-light);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.br-room-card:hover { border-color: var(--secondary); }
.br-room-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.br-room-code { font-size: 0.9rem; font-weight: 600; }
.br-room-status {
  font-size: 0.78rem; font-weight: 600;
  padding: 2px 10px; border-radius: 10px;
}
.br-status-waiting { background: var(--warn-soft); color: var(--warn); }
.br-status-playing { background: var(--ok-soft); color: var(--ok); }
.br-status-done { background: var(--bg-deep); color: var(--sub); }
.br-room-players { font-size: 0.9rem; margin-bottom: 4px; }
.br-room-bottom { display: flex; gap: 12px; }

/* ══════════════════════════════════════════════════
   CHALLENGE – rank list
   ══════════════════════════════════════════════════ */
.ch-rank-list { display: flex; flex-direction: column; gap: 4px; }
.ch-rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-deep); border-radius: 8px;
}
.ch-rank-pos {
  font-weight: 700; font-size: 0.9rem;
  width: 28px; text-align: center; color: var(--sub);
}
.ch-rank-top { color: var(--accent); }
.ch-rank-name { flex: 1; font-weight: 500; }
.ch-rank-scores { text-align: right; }
.ch-rank-total { font-weight: 700; font-size: 1rem; }

/* ══════════════════════════════════════════════════
   CALENDAR – enhanced grid
   ══════════════════════════════════════════════════ */
.cal-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal-day { display: block; font-size: 0.85rem; font-weight: 600; }
.cal-count { display: block; font-size: 0.7rem; color: var(--sub); }

/* ══════════════════════════════════════════════════
   FOCUS PAGE
   ══════════════════════════════════════════════════ */
.focus-card { text-align: center; }
.focus-timer {
  font-size: 3.5rem; font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.05em;
  margin: 16px 0;
}
.focus-btns {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════
   BOOKS – card-based list
   ══════════════════════════════════════════════════ */
.bk-list { display: flex; flex-direction: column; gap: 8px; }
.bk-item {
  padding: 12px 14px;
  background: var(--bg-deep); border: 1px solid var(--line-light);
  border-radius: 10px;
}
.bk-item-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bk-item-name { font-size: 0.95rem; }
.bk-item-meta { display: flex; align-items: center; gap: 8px; }
.bk-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bk-rename-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-light); }

/* ══════════════════════════════════════════════════
   MOBILE: ≤ 540px refinements
   ══════════════════════════════════════════════════ */
@media (max-width: 540px) {
  /* Focus page */
  .focus-timer { font-size: 2.8rem; }
  .focus-btns { flex-direction: column; }
  .focus-btns .btn { width: 100%; }

  /* Calendar grid */
  .calendar-grid {
    grid-template-columns: repeat(6, 1fr) !important;
  }

  /* Weekly report cards */
  .wr-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Battle room meta */
  .room-meta-line { flex-direction: column; gap: 4px; }
  .link-share-row { flex-direction: column; gap: 6px; }
  .link-share-row input { width: 100%; }

  /* Focus stats heatmap */
  .heatmap { grid-template-columns: repeat(8, 1fr) !important; }
  .focus-stats-header { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-num { font-size: 24px; }

  /* Books item */
  .bk-item-head { flex-direction: column; align-items: flex-start; }
  .bk-item-actions { width: 100%; }
  .bk-item-actions .btn { flex: 1; text-align: center; }
}

/* Title override: make "词汇冲刺" match nav area background */
.brand-block h1 {
  display: inline-block;
  margin: 0;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-deep) !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: var(--ink) !important;
  font-size: 1rem;
  line-height: 1.2;
  animation: none !important;
  text-shadow: none !important;
}

/* Temporary: hide title block to stabilize nav layout */
.header-main > .brand-block {
  display: none !important;
}

/* Keep nav centered after hiding brand */
.header-main {
  justify-content: center;
}
