.ai-tool-shell {
  margin-top: 1.75rem;
}

.tool-layout {
  padding: 2rem;
}

.tool-layout > p {
  max-width: 48rem;
}

.tool-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.2rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: #f8faf7;
  border: 1px solid #d9dfd5;
  border-radius: 12px;
}

.tool-language-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.tool-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #5f6670;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tool-stat {
  font-weight: 700;
  color: #1a1f26;
}

.dropdown {
  position: relative;
}

.tool-select {
  appearance: none;
  border: 1px solid #d9dfd5;
  background: #ffffff;
  color: #1a1f26;
  padding: 0.65rem 0.95rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 10rem;
  background: #ffffff;
  border: 1px solid #d9dfd5;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26, 31, 38, 0.08);
  z-index: 10;
}

.dropdown-content a {
  display: block;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: #1a1f26;
}

.dropdown-content a:hover {
  background: #f3f5f1;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.trainer-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.trainer-copy,
.word-pair-panel {
  background: #ffffff;
  border: 1px solid #d9dfd5;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(26, 31, 38, 0.04);
}

.trainer-copy {
  padding: 1.5rem;
  min-height: 24rem;
}

.trainer-copy p {
  margin: 0 0 1rem;
}

.main-text {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.2;
  font-weight: 800;
  color: #1a1f26;
}

.ipa-text {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.45;
  color: #0e7a65;
}

.recorded-ipa-text,
.translation-text {
  font-size: 1rem;
  line-height: 1.65;
  color: #5f6670;
}

.trainer-next {
  display: flex;
}

.button-next {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #1fae72, #129360);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 1rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(26, 31, 38, 0.04);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.button-next:hover {
  background: linear-gradient(180deg, #18925f, #0f7a50);
  transform: translateY(-1px);
}

.button-next span {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.06em;
}

.word-pair-panel {
  margin-bottom: 1rem;
  padding: 0.95rem 1.1rem;
  text-align: center;
}

.word-pair-panel p {
  margin: 0;
  font-size: 1rem;
  color: #5f6670;
}

.button-wrapper {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.control-button {
  appearance: none;
  border: 1px solid #d9dfd5;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  min-width: 9rem;
  background: #ffffff;
  color: #1a1f26;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.control-button:hover {
  background: #f3f5f1;
  transform: translateY(-1px);
}

.control-button-primary {
  background: #0e7a65;
  border-color: #0e7a65;
  color: #ffffff;
}

.control-button-primary:hover {
  background: #0b6655;
  border-color: #0b6655;
}

.control-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1.2rem;
  line-height: 1;
}

.control-icon-mic {
  font-size: 1.35rem;
}

.control-text {
  white-space: nowrap;
}

.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.difficulty-selector {
  background: #f6f7fd;
  padding: 0.35rem;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(35, 33, 45, 0.15);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.radio input {
  width: max-content;
  appearance: none;
  outline: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  background: #454857;
  color: #d1d5db;
  font-size: 0.88rem;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  transition: all 100ms linear;
}

.radio input:checked {
  background-image: linear-gradient(180deg, #0e7a65, #1a9a7d);
  color: #ffffff;
}

.radio input:before {
  content: attr(label);
  display: inline-block;
}

#original_script.disabled,
#ipa_script.disabled,
#recorded_ipa_script.disabled,
#translated_script.disabled {
  opacity: 0.55;
}

#single_word_ipa_pair a,
#original_script a,
#translated_script a {
  color: #0e7a65;
}

#single_word_ipa_pair a:hover,
#original_script a:hover,
#translated_script a:hover {
  color: #0b6655;
}

@media (max-width: 900px) {
  .trainer-stage {
    grid-template-columns: 1fr;
  }

  .trainer-next {
    order: -1;
  }

  .button-next span {
    writing-mode: initial;
    transform: none;
  }
}

@media (max-width: 640px) {
  .tool-layout {
    padding: 1.3rem;
  }

  .trainer-copy {
    padding: 1.1rem;
    min-height: 0;
  }

  .tool-status-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-button {
    min-width: 0;
    width: 100%;
  }

  .button-wrapper {
    flex-direction: column;
  }
}
