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

html, body {
  height: 100%;
  background-color: #e8eaed;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: #333;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-root {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f5f7fa;
  position: relative;
  display: flex;
  flex-direction: column;
}

.tabbar {
  display: flex;
  height: 50px;
  background: #ffffff;
  border-top: 1px solid #e8eaed;
  position: sticky;
  bottom: 0;
  z-index: 100;
  flex-shrink: 0;
}

.tab-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.tab-item.active {
  color: #4A90E2;
  font-weight: 500;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ========== Intro Page ========== */
.intro-page {
  padding: 20px;
  background: linear-gradient(180deg, #EBF3FB 0%, #f5f7fa 150px);
  min-height: calc(100vh - 50px);
}

.intro-header {
  text-align: center;
  padding: 30px 0;
}

.intro-header .title {
  font-size: 28px;
  font-weight: bold;
  color: #4A90E2;
  margin-bottom: 8px;
}

.intro-header .subtitle {
  font-size: 18px;
  color: #666;
  font-weight: 500;
}

.intro-content {
  padding-bottom: 40px;
}

.intro-page .section {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.intro-page .section-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 3px solid #4A90E2;
}

.intro-page .section-text {
  font-size: 14px;
  color: #555;
  line-height: 1.8;
  text-align: justify;
}

.category-list {
  margin-top: 12px;
}

.category-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.category-name {
  font-size: 15px;
  font-weight: 500;
  color: #4A90E2;
  margin-bottom: 4px;
}

.category-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}

.intro-page .note {
  background: #FFF8E6;
  border-radius: 8px;
  padding: 12px;
  margin-top: 20px;
  text-align: center;
}

.note-text {
  font-size: 14px;
  color: #E6A23C;
}

.intro-footer {
  text-align: center;
  padding: 20px 0 10px;
  font-size: 12px;
  color: #999;
}

.intro-footer a {
  color: #999;
  text-decoration: none;
}

.intro-footer a:hover {
  color: #4A90E2;
  text-decoration: underline;
}

/* ========== Words Page ========== */
.words-page {
  height: calc(100vh - 50px);
  background: linear-gradient(180deg, #EBF3FB 0%, #f5f7fa 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.words-page .header {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  flex-shrink: 0;
  background: transparent;
}

.words-page .progress-bar {
  flex: 1;
  height: 4px;
  background: #E0E0E0;
  border-radius: 2px;
  overflow: hidden;
}

.words-page .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90E2, #67B26F);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.words-page .progress-text {
  font-size: 12px;
  color: #666;
  margin-left: 10px;
  min-width: 60px;
  text-align: right;
}

.words-page .list-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  cursor: pointer;
}

.words-page .list-icon {
  font-size: 20px;
  color: #666;
}

.words-page .card-container {
  flex: 1;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  z-index: 10;
  font-size: 24px;
  color: #4A90E2;
  user-select: none;
  transition: all 0.2s;
  line-height: 1;
}

.nav-arrow:hover {
  background: #4A90E2;
  color: white;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.nav-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-arrow.disabled:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #4A90E2;
}

.nav-prev {
  left: 4px;
}

.nav-next {
  right: 4px;
}

.word-swiper {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.word-swiper::-webkit-scrollbar {
  display: none;
}

.word-card {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  box-sizing: border-box;
}

.word-swiper.learned .word-card .card-inner {
  background: linear-gradient(135deg, #f0fff4 0%, #e6ffed 100%);
  border: 1px solid #9AE6B4;
}

.card-inner {
  width: 100%;
  max-width: 360px;
  background: white;
  border-radius: 12px;
  padding: 40px 20px;
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.12);
  text-align: center;
  position: relative;
  box-sizing: border-box;
}

.word-swiper.learned .card-inner {
  background: linear-gradient(135deg, #f0fff4 0%, #e6ffed 100%);
  border: 1px solid #9AE6B4;
}

.word-category {
  display: inline-block;
  font-size: 11px;
  color: #4A90E2;
  background: #EBF3FB;
  padding: 4px 10px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.word-text {
  font-size: 44px;
  font-weight: bold;
  color: #333;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.word-phonetic {
  font-size: 16px;
  color: #888;
  margin-bottom: 20px;
}

.word-divider {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, #4A90E2, #67B26F);
  margin: 0 auto 20px;
  border-radius: 1px;
}

.word-meaning {
  font-size: 18px;
  color: #555;
  line-height: 1.6;
}

.learned-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 12px;
  color: #48BB78;
  background: #C6F6D5;
  padding: 4px 8px;
  border-radius: 8px;
}

.words-page .action-bar {
  padding: 15px 30px 25px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn {
  width: 100%;
  height: 48px;
  line-height: 1;
  border-radius: 24px;
  font-size: 16px;
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s;
}

.action-btn:hover {
  opacity: 0.9;
}

.btn-learn {
  background: linear-gradient(135deg, #4A90E2 0%, #67B26F 100%);
  color: white;
}

.btn-unlearn {
  background: #f0f0f0;
  color: #666;
}

/* ========== Word List Modal ========== */
.wordlist-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 50px;
  background: #f5f7fa;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.wordlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: linear-gradient(135deg, #4A90E2 0%, #67B26F 100%);
  flex-shrink: 0;
}

.wordlist-title {
  font-size: 18px;
  font-weight: bold;
  color: white;
}

.wordlist-close {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
  padding: 5px;
  cursor: pointer;
}

.filter-area {
  background: white;
  padding: 12px 15px;
  flex-shrink: 0;
  border-bottom: 1px solid #eee;
}

.filter-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.filter-label {
  font-size: 13px;
  color: #666;
  width: 35px;
  flex-shrink: 0;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
}

.filter-tag {
  font-size: 12px;
  color: #666;
  background: #f0f0f0;
  padding: 5px 12px;
  border-radius: 12px;
  margin-right: 8px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tag.active {
  background: #4A90E2;
  color: #fff;
  border-color: #4A90E2;
}

.filter-apply {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.apply-btn {
  width: 100%;
  height: 40px;
  line-height: 1;
  background: linear-gradient(135deg, #4A90E2 0%, #67B26F 100%);
  color: white;
  border-radius: 20px;
  font-size: 14px;
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.wordlist-content {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  min-height: 0;
}

.wordlist-section {
  margin-bottom: 15px;
}

.wordlist-category {
  display: flex;
  align-items: center;
  padding: 10px 5px;
}

.wordlist-category .category-name {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

.wordlist-category .category-count {
  font-size: 11px;
  color: #999;
  margin-left: 6px;
}

.wordlist-grid {
  display: flex;
  flex-wrap: wrap;
}

.word-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 12px;
  margin: 4px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.2s;
}

.word-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.word-item.learned {
  background: #f0fff4;
  border-color: #9AE6B4;
}

.word-item.current {
  background: #EBF3FB;
  border-color: #4A90E2;
}

.word-item-text {
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-item.learned .word-item-text {
  color: #48BB78;
}

.word-item.current .word-item-text {
  color: #4A90E2;
  font-weight: bold;
}

.word-item-learned {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  color: #48BB78;
}

.wordlist-bottom {
  height: 30px;
}

/* ========== Sentences Page ========== */
.sentences-page {
  height: calc(100vh - 50px);
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sentences-page .page-header {
  padding: 20px;
  background: linear-gradient(135deg, #4A90E2 0%, #67B26F 100%);
  flex-shrink: 0;
}

.sentences-page .page-title {
  font-size: 20px;
  font-weight: bold;
  color: white;
  margin-bottom: 4px;
}

.sentences-page .page-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.sentence-list {
  flex: 1;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  min-height: 0;
}

.category-group {
  background: white;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.group-header {
  display: flex;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
}

.group-header .group-name {
  flex: 1;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.group-header .group-count {
  font-size: 12px;
  color: #999;
  margin-right: 8px;
}

.group-header .group-arrow {
  font-size: 10px;
  color: #999;
  transition: transform 0.3s ease;
}

.group-header .group-arrow.expanded {
  transform: rotate(180deg);
}

.group-content {
  border-top: 1px solid #f0f0f0;
}

.sentence-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background 0.2s;
}

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

.sentence-item:hover {
  background: #f8fafc;
}

.sentence-en {
  font-size: 15px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 6px;
}

.sentence-zh {
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

/* ========== Detail Modal ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 30px;
  max-width: 480px;
  margin: 0 auto;
}

.detail-modal {
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 30px 20px;
}

.detail-content {
  text-align: center;
}

.detail-en {
  font-size: 20px;
  color: #333;
  line-height: 1.8;
  font-weight: 500;
  margin-bottom: 16px;
}

.detail-divider {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, #4A90E2, #67B26F);
  margin: 0 auto 16px;
  border-radius: 1px;
}

.detail-zh {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
}

.detail-close {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
  cursor: pointer;
}

.close-text {
  font-size: 14px;
  color: #4A90E2;
}

/* ========== Responsive ========== */
@media (min-width: 481px) {
  .app-root {
    border-left: 1px solid #e8eaed;
    border-right: 1px solid #e8eaed;
  }
}

@media (max-height: 640px) {
  .card-inner {
    padding: 25px 15px;
  }
  .word-text {
    font-size: 36px;
  }
  .word-meaning {
    font-size: 15px;
  }
}
