body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: #fafbfc;
  color: #222;
}

/* Custom Plyr Styles */
.plyr {
  border-radius: 10px;
  margin: 0.7rem 0;
  --plyr-color-main: #0074d9;
}

.plyr--audio .plyr__control--overlaid {
  display: flex;
  padding: 20px;
  background: rgba(0, 116, 217, 0.8);
  border: 2px solid white;
}

.plyr--audio .plyr__controls {
  display: flex;
  flex-direction: column;
  padding: 20px 15px 10px;
  background: #f8f9fa;
  border-radius: 10px;
}

.plyr--audio .plyr__control.plyr__tab-focus,
.plyr--audio .plyr__control:hover,
.plyr--audio .plyr__control[aria-expanded=true] {
  background: rgba(0, 116, 217, 0.8);
}

.plyr__controls .plyr__controls__item.plyr__progress__container {
  width: 100%;
  margin-top: 18px;
  margin-bottom: 18px;
  order: 2;
}

.plyr__controls .plyr__controls__item.plyr__time {
  order: 3;
}

.plyr__controls .plyr__controls__item.plyr__volume {
  order: 4;
}

.plyr__controls .plyr__controls__item:first-child {
  margin: 0 auto;
  transform: scale(1.5);
  order: 1;
}

.plyr--full-ui input[type=range] {
  height: 8px;
}

.custom-player-container {
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding: 0.2em 0;
  margin: 0.7rem 0 1.5rem 0;
}
#app {
  max-width: 480px;
  margin: 2rem auto 0 auto;
  min-height: 100vh;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  border-radius: 18px;
  padding-bottom: 2rem;
}
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem 1rem 2rem 1rem;
}
.screen.active {
  display: flex;
}
.header-flex {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 100vw;
  margin-bottom: 1.5rem;
  margin-top: 1.5rem;
  padding-right: 0.5rem;
}
.header-left, .header-right {
  flex: 1 1 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.header-left {
  justify-content: center;
}
.header-right {
  justify-content: center;
}
.title-header {
  height: 112px;
  max-width: 90vw;
  object-fit: contain;
  display: block;
}
.logo {
  width: 115px;
  height: 115px;
  object-fit: contain;
  margin-right: 0;
  margin-top: 0.6rem;
}
.languages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0.5rem 0;
  margin: 0;
}
.language-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  min-height: 56px;
  box-sizing: border-box;
  font-size: 1.1rem;
}
.language-btn:hover {
  background: #f5f5f5;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.language-btn img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
}
.language-btn span {
  font-size: 1.05rem;
  color: #222;
  font-weight: 500;
}
.language-btn:active, .language-btn:focus {
  background: #e0e7ef;
}
#audio-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
#audio-list li {
  background: #f3f4f6;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.audio-track-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #222;
  cursor: pointer;
  flex: 1;
  text-align: left;
}
.audio-track-btn.played {
  opacity: 0.5;
  text-decoration: line-through;
}
.checkmark {
  color: #2ecc40;
  font-size: 1.3rem;
  margin-left: 0.5rem;
}
.audio-list-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 0.2rem;
}
#back-to-languages {
  font-size: 1.7rem;
  margin: 0;
  padding: 0.2em 0.5em 0.2em 0.1em;
  background: none;
  border: none;
  color: #0074d9;
  border-radius: 50%;
  transition: background 0.15s;
}
#back-to-languages:hover, #back-to-languages:focus {
  background: #e0e7ef;
}
#back-to-list {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #0074d9;
  margin-right: 0.5rem;
}
.player-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
  padding-bottom: 1rem;
}
#audio-player, .inline-player-container audio {
  width: 100%;
  height: 54px;
  min-height: 54px;
  margin: 0.7rem 0 0.7rem 0;
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding: 0.2em 0;
}
audio::-webkit-media-controls-panel {
  transform: scale(1.15);
}
audio::-webkit-media-controls-play-button {
  transform: scale(1.3);
}
.played-indicator {
  min-height: 1.2em;
  color: #2ecc40;
  font-size: 1.1em;
  margin-bottom: 0.5rem;
}
#transcript-container, .inline-transcript {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.3rem 1.2rem;
  border: 1px solid #e3e6ea;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  margin-top: 1.5rem;
}
#transcript, .inline-transcript {
  font-size: 1.13rem;
  color: #232323;
  line-height: 1.8;
  letter-spacing: 0.01em;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  animation: fadeIn 0.5s;
}
#transcript p, .inline-transcript p {
  margin: 0 0 1.1em 0;
}
#transcript ul, .inline-transcript ul {
  margin: 0.5em 0 1.1em 1.5em;
  padding-left: 1.2em;
}
#transcript li, .inline-transcript li {
  margin-bottom: 0.5em;
  font-size: 1.08em;
}
#transcript strong, .inline-transcript strong {
  color: inherit; /* Changed from #0074d9 to inherit parent color */
  font-weight: 600;
}
#transcript h3, .inline-transcript h3 {
  font-size: 1.18em;
  margin-bottom: 0.7em;
  color: #222;
  font-weight: 700;
  letter-spacing: 0.01em;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.audio-list-header, .player-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.audio-list-item {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  margin-bottom: 1rem;
  background: #f9f9fb;
  transition: box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  scroll-margin-top: 20px; /* header height + spacing */
}
.audio-list-item .audio-track-btn {
  width: 100%;
  text-align: left;
  font-size: 1.1rem;
  background: none;
  border: none;
  outline: none;
  padding: 1rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}
.inline-player-container {
  margin-top: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
}
.inline-player-container.expanded {
  max-height: 2000px; /* Increased to ensure all content is visible */
  opacity: 1;
  padding-bottom: 2rem; /* Added padding at the bottom */
}
#audio-list-title {
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.6;
  color: #222;
  margin-bottom: 1.2rem;
  padding: 0.2em 0.2em 0.2em 0.2em;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
#audio-list-title ul, #audio-list-title ol {
  margin-left: 1.2em;
  margin-bottom: 0.7em;
}
#audio-list-title li {
  font-size: 1em;
  margin-bottom: 0.3em;
}
#audio-list-title strong {
  font-weight: 600;
  color: inherit; /* Changed from #0074d9 to inherit parent color */
}
@media (max-width: 600px) {
  #app {
    max-width: 100vw;
    box-shadow: none;
    border-radius: 0;
    padding-bottom: 1rem;
  }
  .screen {
    padding: 1rem 0.5rem 1.5rem 0.5rem;
  }
  #audio-player, .inline-player-container audio {
    height: 64px;
    min-height: 64px;
  }
  audio::-webkit-media-controls-play-button,
  audio::-webkit-media-controls-panel {
    transform: scale(1.4);
  }
  .header-flex {
    flex-direction: row;
    margin-bottom: 1rem;
    margin-top: 1rem;
    padding-right: 0;
  }
  .title-header {
    height: 80px;
  }
  .logo {
    width: 80px;
    height: 80px;
  }
}
.audio-list-item.played {
  background: #e6f9e6;
  border: 1.5px solid #2ecc40;
  transition: background 0.3s, border 0.3s;
}
.audio-list-item .checkmark {
  color: #2ecc40;
  font-size: 1.5rem;
  font-weight: bold;
  margin-left: 0.7rem;
}

/* Custom Audio Player Styles */
.custom-audio-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 10px 0;
}

.play-pause-btn {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 112px;
  height: 112px;
  font-size: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.play-pause-btn:hover {
  background: #0056b3;
}

.progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: #007bff;
  border-radius: 4px;
  width: 0%;
  transition: width 0.1s;
}

.progress-container span {
  font-size: 12px;
  color: #6c757d;
}

/* Time indicators layout */
.time-indicators {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  color: #6c757d;
  margin-top: 4px;
}

.current-time {
  color: #007bff;
  font-weight: 500;
}

.total-time {
  color: #6c757d;
}

/* Inline Player Styles */
.inline-custom-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  margin: 5px 0;
}

.inline-play-btn {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 90px;
  height: 90px;
  font-size: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.inline-play-btn:hover {
  background: #0056b3;
}

.inline-progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.inline-progress-bar {
  width: 100%;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.inline-progress-fill {
  height: 100%;
  background: #007bff;
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s;
}

.inline-progress-container span {
  font-size: 11px;
  color: #6c757d;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .custom-audio-player {
    padding: 12px;
  }
  
  .play-pause-btn {
    width: 102px;
    height: 102px;
    font-size: 36px;
  }
  
  .inline-play-btn {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
}
