
.tooltip {
  position: relative;
  cursor: pointer;
  background-color: #eef;
  padding: 2px 4px;
  border-radius: 3px;
}

.tooltip::after {
  content: attr(data-translation);
  position: absolute;
  top: -1.8em;
  left: 0;
  background: #333;
  color: white;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
}

.word {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  box-shadow: none;
  text-decoration: none;
}

.word:hover {
  text-decoration: underline;
  background-color: #f0f0f0; /* optional */
}

.translation-tooltip {
  position: absolute;
  background: #222;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.article-container:empty:before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
  display: block;
}


/* Mobile-specific adjustments */
@media (max-width: 600px) {
  body {
    font-size: 1.1rem;
    padding: 1rem;
    max-width: 100%;
  }

  .article-container {
    width: 100%;
    max-width: 90vw;
    font-size: 1.1rem;
    margin: 1rem auto;
  }

  .translation-tooltip {
    font-size: 1rem;
  }
}

/* Overall page layout */
body {
  font-family: sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
}

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
}

/* Editable box */
.article-container {
  padding: 1rem;
  width: 100%;
  min-height: 40vh;
  font-size: inherit;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-top: 1rem;
  overflow-wrap: break-word;
  outline: none;
  background: white;
}

.subtitle {
  margin-top: -1.5rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  color: #444;
}

#load-translation {
  display: block;
  margin: 1.5rem auto; /* centers it horizontally + spacing */
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  background-color: #4CAF50; /* nice green, change if you like */
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

#load-translation:hover {
  background-color: #45a049;
}

#load-translation:active {
  transform: scale(0.98);
}

#article.pulse {
  animation: pulse 0.8s ease-in-out;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0px rgba(0, 128, 0, 0.6); }
  50%  { box-shadow: 0 0 10px rgba(0, 128, 0, 0.6); }
  100% { box-shadow: 0 0 0px rgba(0, 128, 0, 0.6); }
}
