/* ========== 古诗花园 · Design System ========== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=ZCOOL+KuaiLe&display=swap');

:root {
  --bg-cream: #FFF8F0;
  --bg-garden: linear-gradient(135deg, #E8F5E9 0%, #F1F8E9 40%, #FFF8E1 100%);
  --bg-garden-night: linear-gradient(135deg, #1a237e 0%, #283593 40%, #311b92 100%);
  --pink: #F48FB1;
  --pink-light: #FCE4EC;
  --green: #66BB6A;
  --green-dark: #388E3C;
  --gold: #FFB300;
  --gold-light: #FFF8E1;
  --brown: #795548;
  --text: #4E342E;
  --text-light: #8D6E63;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --font-display: 'ZCOOL KuaiLe', cursive;
  --font-body: 'Noto Serif SC', serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-cream);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ========== Pages ========== */
.page {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.page.active {
  display: flex;
}

/* ========== Welcome ========== */
.welcome-bg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FCE4EC 0%, #F3E5F5 50%, #E8EAF6 100%);
  padding: 20px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 48px;
  background: linear-gradient(135deg, #E91E63, #9C27B0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  margin-bottom: 8px;
}

.welcome-sub {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 40px;
}

.welcome-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 320px;
}

.input-nick {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--pink);
  border-radius: 30px;
  font-size: 18px;
  text-align: center;
  outline: none;
  background: white;
  font-family: var(--font-body);
}

.input-nick:focus {
  border-color: #E91E63;
  box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.15);
}

.avatar-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-option {
  width: 52px;
  height: 52px;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  background: white;
  box-shadow: var(--shadow);
  transition: all .2s;
}

.avatar-option.selected {
  border-color: var(--pink);
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.2);
}

.btn-primary {
  padding: 14px 40px;
  border: none;
  border-radius: 30px;
  font-size: 18px;
  cursor: pointer;
  background: linear-gradient(135deg, #E91E63, #AD1457);
  color: white;
  font-family: var(--font-display);
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
  transition: all .2s;
}

.btn-primary:active {
  transform: scale(0.96);
}

/* ========== Top Bar ========== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.stats {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

/* ========== Garden Grid ========== */
.garden-scroll {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-garden);
  padding: 16px;
  padding-bottom: 80px;
}

/* ========== Season Tabs ========== */
.season-tabs {
  display: flex;
  gap: 6px;
  max-width: 400px;
  margin: 0 auto 12px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

.season-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  border: 2px solid transparent;
}

.season-tab:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

.season-tab.active {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--tab-color, #66BB6A);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.season-tab-icon {
  font-size: 22px;
  line-height: 1;
}

.season-tab-name {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text);
}

.season-tab.active .season-tab-name {
  color: var(--tab-color, #66BB6A);
}

.season-tab-count {
  font-size: 10px;
  color: var(--text-light);
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 8px;
}

.season-tab.active .season-tab-count {
  background: rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Night mode season tabs */
.garden-scroll.night .season-tabs {
  background: rgba(30, 30, 70, 0.5);
}

.garden-scroll.night .season-tab:hover {
  background: rgba(60, 60, 120, 0.5);
}

.garden-scroll.night .season-tab.active {
  background: rgba(50, 50, 100, 0.7);
  border-color: var(--tab-color, rgba(130, 130, 220, 0.5));
}

.garden-scroll.night .season-tab-name {
  color: rgba(200, 200, 255, 0.8);
}

.garden-scroll.night .season-tab.active .season-tab-name {
  color: var(--tab-color, rgba(160, 160, 255, 0.9));
}

.garden-scroll.night .season-tab-count {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(200, 200, 255, 0.6);
}

.garden-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.garden-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all .3s;
  position: relative;
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed rgba(102, 187, 106, 0.3);
}

.garden-cell.planted {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--green);
  animation: gentle-sway 3s ease-in-out infinite;
}

.garden-cell.bloomed {
  border-color: var(--gold);
  background: rgba(255, 248, 225, 0.8);
}

.garden-cell.golden {
  border-color: var(--gold);
  background: linear-gradient(135deg, #FFF8E1, #FFE082);
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.3);
}

.garden-cell:active {
  transform: scale(0.93);
}

.garden-cell .flower-label {
  position: absolute;
  bottom: 2px;
  font-size: 8px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
  text-align: center;
}

@keyframes gentle-sway {

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

  50% {
    transform: rotate(1deg);
  }
}

/* ========== Day/Night ========== */
.garden-scroll.night {
  background: var(--bg-garden-night);
}

.garden-scroll.night .garden-cell {
  background: rgba(30, 30, 80, 0.4);
  border-color: rgba(100, 100, 200, 0.3);
}

.garden-scroll.night .garden-cell.planted {
  background: rgba(40, 40, 100, 0.5);
  border-color: rgba(130, 130, 220, 0.5);
}

.garden-scroll.night .garden-cell.bloomed {
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(50, 40, 80, 0.5);
}

.garden-scroll.night .flower-label {
  color: rgba(200, 200, 255, 0.7);
}

.night-toggle {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  background: var(--gold-light);
  cursor: pointer;
  transition: all .3s;
}

.night-toggle.night {
  background: #1a237e;
}

/* ========== Bottom Nav ========== */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 20;
}

.nav-item {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
  transition: color .2s;
}

.nav-item small {
  font-size: 10px;
  display: block;
  margin-top: 2px;
}

.nav-item.active {
  color: var(--pink);
}

/* ========== Page Header ========== */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.page-header h2 {
  font-size: 18px;
  font-family: var(--font-display);
}

.btn-back {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  background: var(--pink-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== Tabs ========== */
.tab-bar {
  display: flex;
  padding: 8px 16px;
  gap: 8px;
  background: white;
}

.tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: var(--bg-cream);
  color: var(--text-light);
  transition: all .2s;
}

.tab.active {
  background: var(--pink);
  color: white;
}

/* ========== Poem List ========== */
.poem-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 80px;
}

.poem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s;
}

.poem-item:active {
  transform: scale(0.98);
}

.poem-item .status {
  font-size: 24px;
  flex-shrink: 0;
}

.poem-item .info {
  flex: 1;
  min-width: 0;
}

.poem-item .info h3 {
  font-size: 15px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poem-item .info small {
  color: var(--text-light);
  font-size: 12px;
}

/* ========== Quiz ========== */
.quiz-progress {
  padding: 16px;
  text-align: center;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.dot {
  font-size: 28px;
  opacity: 0.3;
  transition: all .3s;
}

.dot.active {
  opacity: 1;
  transform: scale(1.3);
}

.dot.done {
  opacity: 0.7;
}

.quiz-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 20px;
}

.quiz-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.quiz-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--pink);
}

.quiz-card .poem-text {
  font-size: 20px;
  line-height: 2;
  text-align: center;
  margin: 16px 0;
  color: var(--text);
}

.quiz-card .blank {
  border-bottom: 2px solid var(--pink);
  padding: 0 12px;
  color: var(--pink);
}

.option-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  padding: 14px 20px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  background: white;
  text-align: left;
  transition: all .2s;
}

.option-btn:active {
  transform: scale(0.97);
}

.option-btn.correct {
  border-color: var(--green);
  background: #E8F5E9;
}

.option-btn.wrong {
  border-color: #EF5350;
  background: #FFEBEE;
}

.textarea-answer {
  width: 100%;
  min-height: 100px;
  padding: 14px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-size: 16px;
  font-family: var(--font-body);
  resize: vertical;
  outline: none;
}

.textarea-answer:focus {
  border-color: var(--pink);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  cursor: pointer;
  margin-top: 12px;
  font-family: var(--font-display);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-feedback {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #FFF8E1, #FFF3E0);
  border: 1px solid var(--gold);
}

.ai-feedback .score {
  font-size: 24px;
  margin-bottom: 8px;
}

.ai-feedback .comment {
  font-size: 15px;
  color: var(--brown);
}

.recite-modes {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.recite-btn {
  flex: 1;
  padding: 16px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  background: white;
  text-align: center;
  transition: all .2s;
}

.recite-btn.selected {
  border-color: var(--pink);
  background: var(--pink-light);
}

.confirm-btn {
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--green);
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  background: #E8F5E9;
  margin-top: 16px;
  font-family: var(--font-display);
}

.result-banner {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, #FFF8E1, #FCE4EC);
  border-radius: var(--radius);
  margin: 16px 0;
}

.result-banner .flower {
  font-size: 64px;
  animation: bloom 0.8s ease-out;
}

@keyframes bloom {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }

  60% {
    transform: scale(1.3) rotate(10deg);
  }

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


/* ===== Stage 0: 读诗 ===== */
.stage0-poem {
  background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.stage0-meta {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.stage0-line {
  font-size: 20px;
  line-height: 2;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all .3s;
}

.stage0-line:hover {
  background: rgba(255, 138, 128, 0.1);
}

.stage0-line.highlighted {
  background: rgba(255, 138, 128, 0.2);
  color: var(--pink);
  font-weight: 600;
  transform: scale(1.05);
}

.stage0-section {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #E0E0E0;
}

.stage0-section strong {
  display: block;
  margin-bottom: 8px;
  color: var(--brown);
  font-size: 14px;
}

.stage0-section p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
}

.stage0-timer {
  text-align: center;
  padding: 10px;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 8px;
}

/* Stage 0: meaning reveal per-line */
.stage0-meaning {
  background: rgba(255, 138, 128, 0.06);
  border-left: 3px solid var(--pink);
  border-radius: 0 8px 8px 0;
  margin: 0 8px 6px;
  transition: max-height .4s ease, opacity .4s ease, padding .3s;
}

/* Stage 0: read-aloud karaoke */
.read-aloud-line {
  transition: all .3s;
}

.read-aloud-line.highlighted {
  background: rgba(255, 138, 128, 0.2);
  color: var(--pink);
  font-weight: 600;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(255, 138, 128, 0.15);
}

.read-aloud-line.speaking {
  animation: speakPulse 1s ease-in-out infinite;
  cursor: pointer;
}

@keyframes speakPulse {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(255, 138, 128, 0.15);
  }

  50% {
    box-shadow: 0 4px 16px rgba(255, 138, 128, 0.35);
  }
}

.read-aloud-line {
  cursor: pointer;
}

.read-aloud-line:hover {
  background: rgba(255, 138, 128, 0.08);
}

.btn-mute-toggle {
  display: inline-block;
  background: none;
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 3px 12px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 12px;
  color: var(--text-light);
  transition: all 0.2s;
}

.btn-mute-toggle:hover {
  border-color: var(--pink);
  color: var(--pink);
}

/* ========== Poem Detail TTS Read-Aloud ========== */
.detail-poem-content {
  position: relative;
}

.detail-poem-line {
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 1px;
}

.detail-poem-line:hover {
  background: rgba(255, 138, 128, 0.08);
}

.detail-poem-line.highlighted {
  background: rgba(255, 138, 128, 0.18);
  color: var(--pink);
  font-weight: 600;
  transform: scale(1.03);
}

.detail-poem-line.speaking {
  animation: speakPulse 1s ease-in-out infinite;
}

.btn-tts-play {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 6px 18px;
  background: linear-gradient(135deg, #FF8A80, #FF6B6B);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.btn-tts-play:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.btn-tts-play.playing {
  background: linear-gradient(135deg, #78909C, #607D8B);
  box-shadow: 0 2px 8px rgba(96, 125, 139, 0.3);
}

/* Detail action bar — stage progress + action button */
.detail-action-bar {
  padding: 16px 0 4px;
  text-align: center;
}

.stage-progress-bar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-bottom: 14px;
  padding: 0 8px;
}

.stage-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stage-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.stage-dot.done {
  background: linear-gradient(135deg, #66BB6A, #43A047);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(67, 160, 71, 0.3);
}

.stage-dot.done:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(67, 160, 71, 0.45);
}

.stage-dot.active {
  background: linear-gradient(135deg, #42A5F5, #1E88E5);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30, 136, 229, 0.35);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.stage-dot.active:hover {
  transform: scale(1.15);
}

@keyframes dotPulse {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(30, 136, 229, 0.35);
  }

  50% {
    box-shadow: 0 3px 14px rgba(30, 136, 229, 0.6);
  }
}

.stage-dot.locked {
  background: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
}

.stage-dot-connector {
  width: 20px;
  height: 3px;
  background: #e0e0e0;
  margin: 17px 4px 0;
  border-radius: 2px;
  flex-shrink: 0;
}

.stage-dot-connector.done {
  background: linear-gradient(90deg, #66BB6A, #43A047);
}

.stage-dot-label {
  font-size: 10px;
  color: var(--text-light);
  white-space: nowrap;
}

.btn-detail-action {
  display: inline-block;
  padding: 12px 32px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-detail-action:hover {
  transform: translateY(-2px);
}

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

.btn-detail-action.new {
  background: linear-gradient(135deg, #66BB6A, #43A047);
  box-shadow: 0 3px 12px rgba(67, 160, 71, 0.35);
}

.btn-detail-action.learning {
  background: linear-gradient(135deg, #42A5F5, #1E88E5);
  box-shadow: 0 3px 12px rgba(30, 136, 229, 0.35);
}

.btn-detail-action.review {
  background: linear-gradient(135deg, #FFA726, #FB8C00);
  box-shadow: 0 3px 12px rgba(251, 140, 0, 0.35);
}

/* Stage 3: hint input */
.hint-input {
  transition: border-color .2s, background .2s;
  font-family: var(--font-body);
}

.hint-input:focus {
  border-color: var(--pink) !important;
}

/* ===== Stage 1: quiz prompt ===== */
.quiz-prompt {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-cream);
  border-radius: 10px;
  text-align: center;
}

.quiz-ref {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
  padding: 10px;
  background: #FFF3E0;
  border-radius: 8px;
  border-left: 3px solid var(--gold);
}

/* ===== Stage 2: 排序 ===== */
.sort-pool {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sort-line {
  padding: 14px 16px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  background: white;
  transition: all .2s;
  text-align: center;
}

.sort-line:hover {
  border-color: var(--pink);
  background: var(--pink-light);
}

.sort-line.picked {
  opacity: 0.3;
  border-style: dashed;
  pointer-events: none;
}

.sort-result-label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.sort-result {
  min-height: 50px;
  border: 2px dashed #E0E0E0;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sort-placed {
  padding: 12px 16px;
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  border: 1px solid var(--green);
  transition: all .2s;
}

.sort-placed:hover {
  background: #FFEBEE;
  border-color: #EF5350;
}

/* ===== Stage 2: 渐消记忆 ===== */
.fade-poem {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
  border-radius: 12px;
  margin-bottom: 12px;
}

.fade-line {
  font-size: 20px;
  line-height: 2.2;
  letter-spacing: 2px;
}

.fade-char {
  display: inline-block;
  min-width: 1.2em;
  transition: all .5s;
}

.fade-char.fade-blank {
  border-bottom: 2px solid var(--pink);
  min-width: 1.5em;
  min-height: 1.5em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 1px;
}

.fade-cell {
  width: 1.5em;
  height: 1.5em;
  border: none;
  border-bottom: 2px solid var(--pink);
  background: rgba(255, 138, 128, 0.06);
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  outline: none;
  caret-color: var(--pink);
  padding: 0;
  border-radius: 4px 4px 0 0;
  transition: all .2s;
}

.fade-cell:focus {
  background: rgba(255, 138, 128, 0.15);
  border-color: var(--pink);
  box-shadow: 0 2px 6px rgba(255, 138, 128, 0.2);
}

.fade-char.fade-correct {
  color: var(--green) !important;
  font-weight: 600;
  border-color: var(--green);
}

.fade-char.fade-wrong {
  color: #EF5350 !important;
  font-weight: 600;
  border-color: #EF5350;
}

/* ========== Modal ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--pink-light);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.poem-detail h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--pink);
  margin-bottom: 4px;
}

.poem-detail .meta {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 16px;
}

.poem-detail .content {
  font-size: 20px;
  line-height: 2;
  text-align: center;
  margin: 16px 0;
  padding: 16px;
  background: var(--bg-cream);
  border-radius: 12px;
}

.poem-detail .section {
  margin-top: 16px;
}

.poem-detail .section h4 {
  font-size: 14px;
  color: var(--pink);
  margin-bottom: 8px;
}

.poem-detail .section p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-light);
}

/* ========== Profile ========== */
.profile-card {
  text-align: center;
  padding: 30px 20px;
  margin: 16px;
  background: linear-gradient(135deg, #FCE4EC, #F3E5F5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-avatar {
  font-size: 56px;
  margin-bottom: 8px;
}

.profile-name {
  font-size: 22px;
  font-family: var(--font-display);
  margin-bottom: 16px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.profile-stats div {
  text-align: center;
}

.profile-stats strong {
  display: block;
  font-size: 24px;
  color: var(--pink);
}

.profile-stats small {
  font-size: 12px;
  color: var(--text-light);
}

.settings-section {
  margin: 16px;
  padding: 16px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

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

.setting-row label {
  font-size: 14px;
  white-space: nowrap;
}

.setting-row input,
.setting-row select {
  flex: 1;
  padding: 10px;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.achievements {
  padding: 0 16px 100px;
}

.achievements h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin: 4px;
  background: var(--gold-light);
  border-radius: 20px;
  font-size: 13px;
}

.badge.locked {
  background: #F5F5F5;
  opacity: 0.5;
}

/* ========== Star Burst ========== */
#star-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
}

.star-particle {
  position: absolute;
  font-size: 20px;
  animation: star-fly 1.2s ease-out forwards;
}

@keyframes star-fly {
  0% {
    transform: scale(0) translate(0, 0);
    opacity: 1;
  }

  50% {
    transform: scale(1.2) translate(var(--tx), var(--ty));
    opacity: 1;
  }

  100% {
    transform: scale(0.5) translate(calc(var(--tx)*2), calc(var(--ty)*2));
    opacity: 0;
  }
}

/* ========== Achievement Toast ========== */
.achievement-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFD54F, #FF8F00);
  color: #4E342E;
  padding: 14px 28px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: 16px;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(255, 179, 0, 0.4);
  transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.achievement-toast.show {
  top: 60px;
}

/* ========== Search Bar ========== */
.search-bar {
  padding: 8px 16px 0;
}

.search-input {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid #E0E0E0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: white;
  font-family: var(--font-body);
}

.search-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(244, 143, 177, 0.15);
}

/* ========== Progress Bar ========== */
.profile-progress {
  margin-top: 16px;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: #E0E0E0;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.profile-progress small {
  display: block;
  text-align: center;
  margin-top: 6px;
  color: var(--text-light);
  font-size: 12px;
}

/* ========== Study History ========== */
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F0F0F0;
  font-size: 13px;
}

.history-item:last-child {
  border-bottom: none;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========== Poem Item Badge ========== */
.poem-item .stage-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 2px;
}

.stage-badge.new {
  background: #E3F2FD;
  color: #1565C0;
}

.stage-badge.learning {
  background: #FFF3E0;
  color: #E65100;
}

.stage-badge.done {
  background: #E8F5E9;
  color: #2E7D32;
}

/* ========== Enhanced Bloom ========== */
.garden-cell.golden::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  animation: golden-glow 2s ease-in-out infinite alternate;
}

@keyframes golden-glow {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }

  100% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* ========== Correct Answer Shake ========== */
@keyframes correct-shake {

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

  20% {
    transform: translateX(-3px);
  }

  40% {
    transform: translateX(3px);
  }

  60% {
    transform: translateX(-2px);
  }

  80% {
    transform: translateX(2px);
  }
}

.option-btn.correct {
  animation: correct-shake 0.4s ease;
}

/* ========== Petals ========== */
#petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.petal {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50% 0;
  background: rgba(244, 143, 177, 0.4);
  animation: fall linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ========== Loading ========== */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--pink);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* ========== Radar Chart ========== */
.radar-section {
  margin: 16px;
}

.radar-section h3 {
  margin-bottom: 12px;
  font-family: var(--font-display);
}

.radar-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.radar-wrap svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

/* ========== Water Drops ========== */
.water-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #1E88E5;
  font-family: var(--font-display);
  font-size: 15px;
}

.water-anim {
  animation: waterPop .5s ease;
}

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

  50% {
    transform: scale(1.6);
  }

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

/* ========== Garden Decorations ========== */
.deco-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.deco-bar button {
  background: linear-gradient(135deg, #FFB300, #FF8F00);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-display);
  box-shadow: 0 2px 8px rgba(255, 179, 0, 0.3);
}

.deco-shop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
}

.deco-shop.open {
  display: flex;
  align-items: flex-end;
}

.deco-shop-panel {
  width: 100%;
  max-height: 55vh;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 16px;
  overflow-y: auto;
  animation: slideUp .3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.deco-shop-panel h3 {
  text-align: center;
  margin-bottom: 16px;
  font-family: var(--font-display);
}

.deco-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.deco-bonus-bar {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #FFF8E1, #FFE082);
  border-radius: 10px;
  color: #795548;
  font-weight: 600;
  margin-bottom: 4px;
}

.deco-rarity-title {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 0 2px;
  font-family: var(--font-display);
}

.deco-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-radius: 12px;
  border: 2px solid #f0f0f0;
  cursor: pointer;
  transition: all .2s;
}

.deco-item:hover {
  border-color: var(--gold);
  transform: scale(1.05);
}

.deco-item.owned {
  background: #F1F8E9;
}

.deco-item .deco-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.deco-item .deco-name {
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}

.deco-item .deco-effect {
  font-size: 9px;
  font-weight: 600;
  margin-top: 2px;
}

.deco-item .deco-cost {
  font-size: 10px;
  color: #1E88E5;
  margin-top: 2px;
}

.garden-deco-layer {
  position: absolute;
  pointer-events: none;
}

.placed-deco {
  position: absolute;
  font-size: 22px;
  animation: decoPlace .4s ease;
}

@keyframes decoPlace {
  from {
    transform: scale(0) rotate(-30deg);
  }

  to {
    transform: scale(1) rotate(0);
  }
}

/* ========== Bloom Particles ========== */
.bloom-burst {
  position: absolute;
  pointer-events: none;
  z-index: 50;
}

.bloom-particle {
  position: absolute;
  font-size: 14px;
  animation: bloomFly 1.2s ease-out forwards;
}

@keyframes bloomFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--bx), var(--by)) scale(0.3);
  }
}

/* ========== Dictation Char Highlights ========== */
.char-diff {
  display: inline;
  font-size: 18px;
  letter-spacing: 2px;
  line-height: 2;
  font-family: var(--font-body);
}

.char-correct {
  color: var(--green-dark);
}

.char-wrong {
  color: #EF5350;
  background: #FFEBEE;
  border-radius: 3px;
  padding: 0 2px;
  text-decoration: underline wavy #EF5350;
}

.char-missing {
  color: #BDBDBD;
  background: #F5F5F5;
  border-radius: 3px;
  padding: 0 2px;
}

/* ========== Collection Filters ========== */
.collection-filters {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  flex-shrink: 0;
}

.collection-filters .tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #E0E0E0;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}

.collection-filters .tab.active {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
}

/* ========== Special Achievement ========== */
.badge.special {
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: #fff;
  border: 2px solid #FFB300;
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.4);
}

.badge.special::after {
  content: '✦';
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 10px;
}

/* ========== Arena ========== */
.arena-rank-card {
  margin: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1a237e, #4a148c);
  color: #fff;
  box-shadow: 0 4px 20px rgba(26, 35, 126, 0.3);
  text-align: center;
}

.arena-rank-card .rank-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.arena-rank-card .rank-name {
  font-family: var(--font-display);
  font-size: 20px;
  margin-bottom: 4px;
}

.arena-rank-card .rank-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.85;
}

.arena-rank-card .rank-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.arena-rank-card .rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FF8F00);
  border-radius: 3px;
  transition: width .5s;
}

.arena-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 16px;
}

.arena-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
}

.arena-mode-btn:hover {
  border-color: var(--pink);
  transform: translateY(-2px);
}

.arena-mode-btn:active {
  transform: scale(0.97);
}

.arena-mode-btn .mode-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.arena-mode-btn .mode-name {
  font-family: var(--font-display);
  font-size: 15px;
  margin-bottom: 2px;
}

.arena-mode-btn small {
  color: var(--text-light);
  font-size: 11px;
}

.arena-history {
  margin: 0 16px 12px;
}

.arena-history h4 {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 14px;
}

.arena-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.btn-wrongbook {
  display: block;
  margin: 8px auto 20px;
  padding: 10px 24px;
  background: #fff;
  border: 1px solid #E0E0E0;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: all .2s;
}

.btn-wrongbook:hover {
  border-color: var(--pink);
}

/* Battle Panel */
.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1a237e, #4a148c);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}

.battle-header .battle-info {
  text-align: center;
}

.battle-header .battle-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.battle-header .battle-player .name {
  font-size: 12px;
}

.battle-header .battle-player .avatar {
  font-size: 28px;
}

.battle-header .battle-player .score {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
}

.battle-timer {
  font-size: 32px;
  font-family: var(--font-display);
  color: #FFD700;
}

.battle-round {
  font-size: 11px;
  opacity: 0.8;
}

.battle-vs {
  font-size: 16px;
  font-weight: 700;
  color: #FFD700;
}

.battle-body {
  padding: 16px;
}

.battle-prompt {
  text-align: center;
  margin-bottom: 16px;
}

.battle-prompt .fly-char {
  display: inline-block;
  font-size: 48px;
  font-family: var(--font-display);
  color: var(--pink);
  background: var(--pink-light);
  width: 72px;
  height: 72px;
  line-height: 72px;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(244, 143, 177, 0.3);
  margin-bottom: 8px;
  animation: charPulse 1.5s ease infinite;
}

@keyframes charPulse {

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

  50% {
    transform: scale(1.08);
  }
}

.battle-prompt .fly-hint {
  font-size: 13px;
  color: var(--text-light);
}

.battle-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.battle-option {
  padding: 14px 10px;
  border-radius: 12px;
  border: 2px solid #E0E0E0;
  background: #fff;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  line-height: 1.4;
}

.battle-option:hover {
  border-color: var(--green);
  background: #F1F8E9;
}

.battle-option.correct {
  border-color: var(--green);
  background: #C8E6C9;
  animation: optPop .3s;
}

.battle-option.wrong {
  border-color: #EF5350;
  background: #FFEBEE;
}

.battle-option.disabled {
  pointer-events: none;
  opacity: 0.6;
}

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

  50% {
    transform: scale(1.05);
  }

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

/* Author Battle Drag */
.author-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.author-zone {
  min-height: 120px;
  border: 2px dashed #BDBDBD;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: all .2s;
}

.author-zone .zone-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 8px;
}

.author-zone.highlight {
  border-color: var(--green);
  background: #F1F8E9;
}

.drag-line {
  padding: 10px;
  background: #fff;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}

.drag-line:hover {
  background: #FFF8E1;
  border-color: var(--gold);
}

.drag-line.placed {
  opacity: 0.4;
  pointer-events: none;
}

/* Match Result */
.match-result {
  text-align: center;
  padding: 30px 16px;
}

.match-result .result-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.match-result .result-text {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 8px;
}

.match-result .result-detail {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 20px;
}

.match-result .rank-change {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.match-result .rank-up {
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: #fff;
  animation: rankGlow 1s ease infinite;
}

@keyframes rankGlow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  }

  50% {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  }
}

/* Rain Effect */
.rain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
}

.raindrop {
  position: absolute;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(100, 181, 246, 0.6));
  animation: rainFall linear forwards;
}

@keyframes rainFall {
  from {
    transform: translateY(-20px);
    opacity: 1;
  }

  to {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Wrongbook */
.wb-stats {
  display: flex;
  justify-content: space-around;
  padding: 10px;
  background: linear-gradient(135deg, #FFF3E0, #FFECB3);
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.wb-stats b {
  font-size: 16px;
}

.wb-top3 {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.wb-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.wb-filter {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  border-radius: 8px;
  font-size: 12px;
  background: #f5f5f5;
  cursor: pointer;
  transition: all 0.2s;
}

.wb-filter.active {
  background: var(--pink);
  color: white;
  font-weight: 600;
}

.wb-group {
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.wb-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #fafafa;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.wb-group-header:hover {
  background: #f5f5f5;
}

.wb-badge {
  font-size: 11px;
  background: var(--pink);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.wb-group-body {
  display: none;
  padding: 4px 12px 12px;
}

.wb-group.open .wb-group-body {
  display: block;
}

.wrongbook-item {
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}

.wrongbook-item.mastered {
  opacity: 0.5;
}

.wrongbook-item .wb-line {
  font-size: 14px;
  margin-bottom: 3px;
}

.wrongbook-item .wb-wrong {
  font-size: 12px;
  color: #E53935;
  margin-bottom: 1px;
}

.wrongbook-item .wb-correct {
  font-size: 12px;
  color: var(--green-dark);
}

.wrongbook-item .wb-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.wb-mastered-tag {
  background: #C8E6C9;
  color: #2E7D32;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.wb-master-btn {
  border: 1px solid #E0E0E0;
  background: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}

.wb-master-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.wb-actions {
  margin-top: 8px;
}

.wb-review-btn {
  display: block;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pink), #E91E63);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wb-review-btn:hover {
  opacity: 0.9;
}

.chat-bubble.pending {
  opacity: 0.5;
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 0.8;
  }
}

/* ========== Input with Mic Button ========== */
.input-with-mic {
  position: relative;
  flex: 1;
}

.input-with-mic .battle-input {
  width: 100%;
  padding-right: 42px;
  box-sizing: border-box;
}

.btn-mic {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  padding: 4px;
  line-height: 1;
}

.btn-mic:hover {
  opacity: 1;
}

.btn-mic.listening {
  opacity: 1;
  animation: micPulse 1s ease infinite;
}

@keyframes micPulse {

  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }

  50% {
    transform: translateY(-50%) scale(1.25);
  }
}

/* ========== Chat Relay (typing/voice) ========== */
.battle-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 0;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: #F5F5F5;
  border-bottom-left-radius: 4px;
}

.chat-bubble.player {
  align-self: flex-end;
  background: #C8E6C9;
  border-bottom-right-radius: 4px;
}

.chat-bubble.player.wrong {
  background: #FFCDD2;
}

.chat-bubble .chat-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.chat-bubble .chat-status {
  display: inline-block;
  margin-left: 6px;
}

/* ========== Typing Input ========== */
.battle-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  align-items: center;
}

.battle-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E0E0E0;
  border-radius: 24px;
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}

.battle-input:focus {
  border-color: var(--pink);
}

.battle-input::placeholder {
  color: #BDBDBD;
}

.battle-input:disabled {
  background: #f5f5f5;
  border-color: #ddd;
  color: #999;
  cursor: not-allowed;
}

.btn-submit-answer:disabled,
.btn-hint:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-submit-answer {
  padding: 10px 20px;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  transition: all .2s;
}

.btn-submit-answer:hover {
  transform: scale(1.05);
}

.btn-submit-answer:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.btn-hint {
  padding: 8px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: var(--text-light);
  white-space: nowrap;
}

/* ========== User Management ========== */
.user-mgmt-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-user-mgmt {
  flex: 1;
  min-width: 90px;
  padding: 10px 8px;
  border: 1.5px solid var(--pink-light);
  background: white;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-user-mgmt:hover {
  background: var(--bg-warm);
  transform: translateY(-1px);
}

.btn-user-mgmt.danger {
  border-color: #EF5350;
  color: #EF5350;
}

.btn-user-mgmt.danger:hover {
  background: #FFEBEE;
}

.user-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  margin-bottom: 8px;
}

.user-item:hover {
  background: var(--bg-warm);
}

.user-item.active {
  border-color: var(--pink);
  background: #FFF0F5;
}

.user-item .user-avatar {
  font-size: 28px;
  width: 40px;
  text-align: center;
}

.user-item .user-info {
  flex: 1;
}

.user-item .user-info strong {
  display: block;
  font-size: 15px;
}

.user-item .user-info small {
  color: var(--text-light);
  font-size: 12px;
}

.user-item .user-delete {
  font-size: 18px;
  color: #ccc;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.user-item .user-delete:hover {
  color: #EF5350;
  background: #FFEBEE;
}

.avatar-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 8px 0;
}

.avatar-row .avatar-option {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #eee;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.avatar-row .avatar-option:hover,
.avatar-row .avatar-option.selected {
  border-color: var(--pink);
  background: #FFF0F5;
  transform: scale(1.1);
}

/* ========== Detail Tabs ========== */
.detail-tabs {
  display: flex;
  gap: 0;
  margin-top: 16px;
  border-bottom: 2px solid #f0f0f0;
}

.dtab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

.dtab.active {
  color: var(--pink);
  border-bottom-color: var(--pink);
}

.dtab:hover:not(.active) {
  color: #666;
  background: rgba(255, 138, 128, 0.04);
}

.detail-tab-content {
  padding: 14px 4px;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
  animation: fadeSlideIn .3s ease;
}

/* ========== Tag System ========== */
/* Detail header: title left, progress+stars right */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-header-left h3 {
  margin: 0 0 2px 0;
}

.detail-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.tag-progress {
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  color: #2E7D32;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.star-row {
  display: flex;
  gap: 2px;
}

.star-btn {
  font-size: 18px;
  cursor: pointer;
  color: #ccc;
  transition: color .15s, transform .15s;
  line-height: 1;
  user-select: none;
}

.star-btn:hover {
  transform: scale(1.2);
}

.star-btn.lit {
  color: #FFB300;
}

/* ========== Flying Flower Relay Scroll ========== */
.relay-scroll {
  background: linear-gradient(180deg, #FFF8E7 0%, #FDF5E6 50%, #F5ECD7 100%);
  border: 1px solid #D4C5A0;
  border-radius: 12px;
  margin: 16px 0;
  padding: 20px 16px 12px;
  max-height: 320px;
  overflow-y: auto;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(139, 119, 75, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.relay-scroll::before,
.relay-scroll::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, #C4A96A, transparent);
  margin: 0 auto 16px;
  width: 60%;
}

.relay-scroll::after {
  margin: 16px auto 0;
}

.relay-scroll::-webkit-scrollbar {
  width: 4px;
}

.relay-scroll::-webkit-scrollbar-thumb {
  background: #C4A96A;
  border-radius: 4px;
}

.relay-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(196, 169, 106, 0.3);
  animation: fadeInEntry 0.4s ease;
}

.relay-entry:last-child {
  border-bottom: none;
}

@keyframes fadeInEntry {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.relay-role {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1.5px solid;
}

.relay-role.ai {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  border-color: #A5D6A7;
}

.relay-role.player {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  border-color: #FFCC80;
}

.relay-role.wrong-role {
  background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
  border-color: #EF9A9A;
}

.relay-body {
  flex: 1;
  min-width: 0;
}

.relay-poem {
  font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
  font-size: 18px;
  letter-spacing: 2px;
  color: #3E2723;
  line-height: 1.8;
}

.relay-poem .fly-highlight {
  color: #C62828;
  font-weight: 700;
}

.relay-source {
  font-size: 12px;
  color: #8D6E63;
  margin-top: 2px;
  font-style: italic;
}

.relay-status {
  font-size: 13px;
  margin-left: 4px;
}

.relay-entry.wrong .relay-poem {
  color: #B71C1C;
  text-decoration: line-through;
  text-decoration-color: rgba(183, 28, 28, 0.3);
}

.relay-entry.fail-reason {
  font-size: 12px;
  color: #C62828;
  margin-top: 2px;
}

.relay-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #8D6E63, #6D4C41);
  color: #FFF8E1;
  border-radius: 20px;
  padding: 5px 18px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 4px;
  font-family: var(--font-display);
  box-shadow: 0 2px 6px rgba(109, 76, 65, 0.3);
}

.relay-score-tag {
  display: inline-block;
  background: linear-gradient(135deg, #FFF8E1, #FFE0B2);
  color: #5D4037;
  border: 1px solid #D7CCC8;
  border-radius: 12px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: 1px;
}