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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: #333;
  background: #faf8f5;
}

.nav {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e8e4df;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #f0ece6;
  font-size: 15px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn.active {
  background: #4a7c59;
  color: #fff;
}

.nav-btn:hover:not(.active) {
  background: #e0dcd5;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* Browse view */
.season-header {
  font-size: 22px;
  font-weight: bold;
  color: #4a7c59;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #4a7c59;
}

.section-header {
  font-size: 17px;
  font-weight: 600;
  color: #7a6a50;
  margin: 16px 0 8px;
  padding: 8px 12px;
  background: #f5f0e8;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.poem-item {
  padding: 12px 16px;
  margin: 6px 0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.poem-item:hover {
  background: #f5f0e8;
}

.poem-title {
  font-size: 16px;
  font-weight: 500;
}

.poem-meta {
  font-size: 13px;
  color: #999;
}

.poem-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 8px;
}

.badge-mastered {
  background: #d4edda;
  color: #155724;
}

.badge-practice {
  background: #fff3cd;
  color: #856404;
}

/* Challenge view */
.challenge-section-select {
  padding: 12px 16px;
  margin: 6px 0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.challenge-section-select:hover {
  background: #f5f0e8;
}

.challenge-container {
  text-align: center;
}

.challenge-poem-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 4px;
}

.challenge-poem-author {
  color: #999;
  font-size: 14px;
  margin-bottom: 8px;
}

.challenge-status {
  font-size: 13px;
  color: #999;
  margin-bottom: 16px;
}

.challenge-progress {
  font-size: 14px;
  color: #999;
  margin-bottom: 12px;
}

.challenge-lines {
  font-size: 20px;
  line-height: 2.4;
  margin-bottom: 24px;
}

.challenge-lines .line-hidden {
  display: inline-block;
  min-width: 120px;
  border-bottom: 2px solid #4a7c59;
  margin: 0 4px;
  color: transparent;
  user-select: none;
}

.challenge-lines .line-hidden.revealed {
  color: #4a7c59;
  border-bottom-color: transparent;
}

.challenge-btn {
  display: inline-block;
  padding: 12px 28px;
  margin: 6px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.challenge-btn-primary {
  background: #4a7c59;
  color: #fff;
}

.challenge-btn-primary:hover {
  background: #3d6a4b;
}

.challenge-btn-success {
  background: #5cb85c;
  color: #fff;
}

.challenge-btn-danger {
  background: #d9534f;
  color: #fff;
}

.challenge-btn-secondary {
  background: #e0dcd5;
  color: #666;
}

/* Stats view */
.stats-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin: 12px 0;
}

.stats-number {
  font-size: 36px;
  font-weight: bold;
  color: #4a7c59;
}

.stats-label {
  font-size: 14px;
  color: #999;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Progress view */
.progress-item {
  padding: 10px 16px;
  margin: 4px 0;
  background: #fff;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

.progress-badge-mastered {
  background: #d4edda;
  color: #155724;
}

.progress-badge-practice {
  background: #fff3cd;
  color: #856404;
}

/* Empty state */
.empty-state {
  color: #999;
  text-align: center;
  padding: 24px;
}

/* Browse detail */
.browse-detail-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
}

.browse-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.browse-back-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #e0dcd5;
  color: #666;
  font-size: 14px;
  cursor: pointer;
}

.browse-detail-nav {
  font-size: 13px;
  color: #999;
}

.browse-detail-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow-y: auto;
}

.browse-detail-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.browse-detail-author {
  color: #999;
  font-size: 15px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.browse-detail-lines {
  font-size: 22px;
  line-height: 2.4;
}

.browse-detail-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.browse-nav-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #4a7c59;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.browse-nav-btn:hover {
  background: #3d6a4b;
}

/* Achievement view */
.achievement-header {
  margin-bottom: 16px;
}

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

.achievement-encouragement {
  flex: 1;
  background: linear-gradient(135deg, #4a7c59, #6ba368);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
}

.clear-btn {
  padding: 12px 16px;
  border: 1px solid #d9534f;
  border-radius: 8px;
  background: transparent;
  color: #d9534f;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.clear-btn:hover {
  background: #d9534f;
  color: #fff;
}

/* Responsive — mobile: bottom nav */
@media (max-width: 480px) {
  body { font-size: 14px; }
  .challenge-lines { font-size: 18px; }
  .stats-number { font-size: 28px; }

  .nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-bottom: none;
    border-top: 1px solid #e8e4df;
    padding: 8px 16px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 100;
  }

  main {
    padding-bottom: 80px;
  }

  .browse-detail-container {
    height: calc(100vh - 140px);
  }
}
