:root {
  --primary-color: #2a2a2a;
  --secondary-color: #3a3a3a;
  --accent-color: #00b4d8;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'Noto Sans TC', 'Poppins', sans-serif;
  background-color: var(--primary-color);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* Header Banner */
.main-banner {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  padding: 4rem 2rem;
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

.main-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="rgba(255,255,255,0.03)" x="0" y="0" width="100" height="100"/></svg>');
  opacity: 0.1;
}

.main-banner h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  animation: fadeInDown 1s ease-out;
}

.main-banner p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  animation: fadeInUp 1s ease-out;
}

/* Book Grid */
.novel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
  padding: 1.2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Book Card */
.book-card {
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.book-card a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--text-primary);
}

.novel-cover {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: block;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.book-card:hover .novel-cover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.novel-info {
  padding: 0.8rem 0.5rem;
  position: relative;
  z-index: 1;
  margin-top: -4px;
}

.novel-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.6em;
}

/* Play Button */
.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  opacity: 0;
  transition: all 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(2px);
  z-index: 2;
}

.book-card:hover .play-btn {
  opacity: 1;
}

.play-btn:hover {
  background: rgba(0, 180, 216, 0.8);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Playing Animation */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(0, 180, 216, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0);
  }
}

.playing {
  animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .novel-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem;
  }

  .book-card {
    max-width: 140px;
  }

  .novel-cover {
    height: 200px;
  }

  .novel-info {
    padding: 0.6rem 0.4rem;
  }

  .novel-title {
    font-size: 0.9rem;
  }

  .play-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

/* Extra Small Devices */
@media (max-width: 480px) {
  .novel-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.8rem;
    padding: 0.8rem;
  }

  .book-card {
    max-width: 120px;
  }

  .novel-cover {
    height: 170px;
  }

  .novel-info {
    padding: 0.5rem 0.3rem;
  }

  .novel-title {
    font-size: 0.85rem;
  }

  .play-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
}

/* Loading Animation */
.loading {
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Enhance Touch Targets */
@media (hover: none) and (pointer: coarse) {
  .nav-button,
  .speech-control-btn,
  .settings-panel button,
  .settings-panel select {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Navigation Controls */
.nav-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem auto;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(5px);
  max-width: 1200px;
  width: 95%;
}

.nav-button {
  flex: 1;
  min-width: 140px;
  padding: 1rem 1.5rem;
  font-size: 18px;
  border-radius: 8px;
  background: var(--secondary-color);
  color: var(--text-primary);
  border: 1px solid var(--accent-color);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
  height: 48px;
}

.nav-button .icon {
  font-size: 20px;
  line-height: 1;
}

/* Index Button (Return to List) */
.nav-button.index-button {
  background: var(--accent-color);
  flex: 0.8;
  font-size: 18px;
}

.nav-button.index-button .icon {
  font-size: 20px;
}

/* Jump Buttons (+/-5) */
.nav-button.jump-button {
  background: var(--secondary-color);
  border-color: rgba(0, 180, 216, 0.5);
  flex: 0.8;
}

/* Previous/Next Buttons */
.nav-button.prev-next {
  flex: 1;
}

/* Page Number Display */
.page-number {
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0.8rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  min-width: 80px;
  text-align: center;
  flex: 0.5;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

/* Responsive Design for Navigation */
@media (max-width: 1024px) {
  .nav-controls {
    width: 98%;
    gap: 0.8rem;
    padding: 1rem;
  }

  .nav-button {
    padding: 0.8rem 1.2rem;
    min-width: 120px;
    font-size: 17px;
    height: 44px;
  }

  .nav-button .icon {
    font-size: 19px;
  }

  .nav-button.index-button {
    font-size: 17px;
  }

  .page-number {
    font-size: 17px;
    height: 44px;
  }
}

@media (max-width: 768px) {
  .nav-controls {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.8rem;
  }

  .nav-button {
    flex: 1 1 auto;
    font-size: 16px;
    padding: 0.8rem;
    min-width: 110px;
    height: 42px;
  }

  .nav-button .icon {
    font-size: 18px;
  }

  .nav-button.index-button {
    flex: 1 1 100%;
    order: -1;
    font-size: 16px;
  }

  .page-number {
    flex: 0 1 80px;
    font-size: 16px;
    padding: 0.8rem;
    height: 42px;
  }
}

@media (max-width: 480px) {
  .nav-controls {
    padding: 0.6rem;
    gap: 0.4rem;
    margin: 1rem auto;
  }

  .nav-button {
    font-size: 16px;
    padding: 0.6rem;
    min-width: 90px;
    height: 40px;
  }

  .nav-button .icon {
    font-size: 18px;
  }

  .nav-button.index-button {
    font-size: 16px;
  }

  .page-number {
    height: 40px;
    padding: 0.6rem;
    min-width: 60px;
    font-size: 16px;
  }
}

/* Button Hover Effects */
.nav-button:hover:not(.disabled) {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.nav-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #666;
  pointer-events: none;
}

.nav-button.jump-button:hover:not(.disabled) {
  background: rgba(0, 180, 216, 0.2);
}

/* Speech Control Buttons */
.speech-control-btn {
  min-height: 44px;
  padding: 0.8rem 1.5rem;
  font-size: 1.1rem;
  border-radius: 8px;
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.speech-control-btn:hover {
  background: rgba(0, 180, 216, 0.8);
  transform: translateY(-2px);
}

.speech-control-btn .icon {
  font-size: 1.3em;
}

/* Animation for Page Transitions */
@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    animation: pageTransition 0.3s ease-out;
}

/* Speech Related Styles */
.speech-highlight-container {
    position: relative;
    margin: 2rem auto;
    max-width: 800px;
    line-height: 1.8;
}

.speech-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 0, 0.2);
    pointer-events: none;
    z-index: 1;
    display: none;
}

#novel-content {
    position: relative;
    z-index: 2;
    margin: 2rem auto;
    max-width: 800px;
    line-height: 1.8;
    font-size: var(--font-size);
    color: var(--text-color);
    padding: 0 1rem;
}

.speech-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

/* Speaking State */
.speaking {
    animation: pulse 2s infinite;
}

.speaking-text {
    background-color: rgba(255, 255, 0, 0.2);
}

/* Voice Selection Dropdown */
#voiceSelect {
    padding: 0.5rem;
    border-radius: 4px;
    background: var(--secondary-color);
    color: var(--text-primary);
    border: 1px solid var(--accent-color);
    cursor: pointer;
}

#voiceSelect:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 180, 216, 0.2);
}

/* Auto Next Page Checkbox */
.auto-next-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-next-page input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.auto-next-page label {
    cursor: pointer;
    user-select: none;
}

/* Emoji icons specific styles */
.nav-button[title*="目錄"] {
  font-size: 18px;
}

.nav-button[title*="目錄"] .icon {
  font-size: 20px;
}

/* Navigation arrows and icons */
.nav-button .arrow-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-button .text {
  display: inline-block;
  vertical-align: middle;
} 