* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: white;
  color: #333;
  align-items: center;
  min-height: 100vh;
  text-align: center;
  padding: 20px;
  flex-direction: column;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #ddd;
  background: white;
  z-index: 1000;
}

.home-icon {
  position: absolute;
  left: 20px;
  display: flex;
  align-items: center;
  height: 100%;
}

.home-icon img {
  height: 25px;
  width: 25px;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: #3c4043;
}

.title {
  font-size: 64px;
  font-weight: 900;
  margin-top: 20px;
  margin-bottom: 20px;
  color: #1a1a1a;
}

.subtitle {
  font-size: 18px;
  color: #5f6368;
  margin-bottom: 40px;
}

.form {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.form-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
}

select {
  padding: 16px 20px;
  border: none;
  border-radius: 40px;
  background-color: #f1f5fb;
  font-size: 16px;
  width: 240px;
  color: #333;
}

select:focus {
  outline: none;
  box-shadow: 0 0 0 2px #cbdffd;
}

.generate-btn {
  margin-top: 10px;
  padding: 16px 40px;
  border: none;
  border-radius: 40px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  border: 1px solid #1a73e8;
  color: #1a73e8;
  transition: all 0.8s;
}

.generate-btn:hover {
  background: #1a73e8;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.container{
  width: 100%; 
  max-width: 100%;
  margin-left: auto; 
  margin-right: auto;
  padding-top: 50px;
  padding-left: 20px;
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center; 
  box-sizing: border-box;
  position: relative;
}

.scene {
  font-size: 18px;
  margin-bottom: 30px;
  background-color: #e2e3e5;
  padding: 24px;
  border-radius: 20px;
  color: #202124;
  text-align: left;
  line-height: 1.6;
  max-width: 800px;
  margin: 40px auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  font-family: 'Segoe UI', sans-serif;
}

.dialogue {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.dialogue-line {
  max-width: 100%;
  padding: 20px;
  border-radius: 20px;
  font-size: 18px;
  line-height: 1.5;
  font-family: 'Segoe UI', sans-serif;
  text-align: left;
  word-wrap: break-word;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin: 0;
  position: relative;
  padding-right: 40px;
}

.dialogue-line.left {
  background-color: #f1f3f4;
}

.dialogue-line.right {
  background-color: #d2e3fc;
}

.dialogue-line strong {
  display: block;
  font-size: 12px;
  color: #5f6368;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.translate-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  transition: color 0.3s;
}

.translate-btn:hover {
  color: #1ae85b;
}

.dialogue-line-wrapper {
  display: flex;
  width: 100%;
}

.dialogue-line-wrapper.left {
  justify-content: flex-start;
  align-items: flex-start;
}

.dialogue-line-wrapper.right {
  justify-content: flex-end;
  align-items: flex-end;
}

.dialogue-line-wrapper.right .slang-tooltip {
  left: auto;
  right: calc(100% + 10px);
}

.dialogue-line-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.speak-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0;
}

.speak-btn:hover {
  color: #1a73e8;
}

.translate-btn {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  align-self: center;
  padding: 4px;
}

.translate-btn:hover {
  color: #1a73e8;
}

.translated-line {
  background-color: #d9f7df;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 16px;
  color: #202124;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  max-width: 75%;
  margin-top: 8px;
  white-space: pre-wrap;
  text-align: left;
  position: relative;
  padding-right: 35px;
}

.translation-left {
  margin-left: 20px;
  margin-right: auto;
}

.translation-right {
  margin-right: 20px;
  margin-left: auto;
}

.close-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0;
}

.close-btn:hover {
  color: #000;
}

.slang-word {
  position: relative;
  text-decoration: underline;
  cursor: pointer;
}

.slang-tooltip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: calc(100% + 10px);
  background-color: #333;
  color: white;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  min-width: 250px;
  max-width: 350px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}

.slang-word:hover .slang-tooltip {
  opacity: 1;
  visibility: visible;
}

.slang-tooltip-title {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 8px;
}

.slang-tooltip p {
  margin: 0;
}

.next-line-btn, #regenerate-btn {
  margin-top: 20px;
  padding: 16px 40px;
  border: none;
  border-radius: 40px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  border: 1px solid #1a73e8;
  color: #1a73e8;
  transition: all 0.8s;
}

.next-line-btn:hover, #regenerate-btn:hover {
  background: #1a73e8;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#loading {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

#loading-gif {
  margin-top: 200px;
  width: 110px;
  height: 110px;
}

.hidden {
  display: none;
}

#speaker-img{
  width: 20px;
  height: 20px;
}

#translate-img{
  width: 20px;
  height: 20px;
}

#backBtn {
  position: absolute;
  top: 60px;
  left: 10px;
}

#backBtn-img {
  width: 35px;
  height: 35px;
}

.languageSwitcher {
  position: absolute;
  top: 50%;
  right: 30px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 15px;
  white-space: nowrap;
}

.languageSwitcher select {
  width: 120px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: white;
  cursor: pointer;
  font-size: 15px;
}

.languageSwitcher select:hover {
  background-color: #f0f0f0;
}

@media (max-width: 768px) {

  .languageLabel{
    visibility: hidden;
  }
    
  .languageSwitcher select {
    font-size: 13px;
  }
   
  .header-title {
    font-size: 13px;
  }

  .slang-tooltip {
    left: 50%;
    top: calc(100% + 10px); 
    transform: translateX(-50%); 
    right: auto;
    max-width: 90vw;
  }

  .dialogue-line-wrapper.right .slang-tooltip {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .slang-word:hover .slang-tooltip {
    transform: translateX(-50%); 
  }
}