:root {
  --primary: hsl(202, 85%, 61%);
  --primary-light: hsl(212, 72%, 70%);
  --primary-light-1: hsl(207, 100%, 97%);
  --primary-1: hsl(207, 85%, 62%);
  --primary-dark: hsl(207, 73%, 57%);
  --secondary-0: hsl(0, 69%, 95%);
  --secondary: hsl(0, 69%, 67%);
  --secondary-1: hsl(0, 60%, 60%);
  --secondary-2: hsl(0, 64%, 55%);
  --secondary-box-shadow: hsl(0 69% 85% / 0.9);
  --tertiary: hsl(230, 80%, 72%);
  --tertiary-dark: #6772e5;

  --text-dark-1: #333333;
  --text-medium-1: #555555;
  --text-light-1: #777777;

  --text-dark: #2c2c2c;
  --text-medium: #5a5a5a;
  --text-light: #757575;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

#nihonez-primary .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.header .subtitle {
  color: var(--text-medium);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ai-badge {
  background: linear-gradient(45deg, var(--tertiary), var(--tertiary-dark));
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.input-card {
  background: var(--bg-white);
  border-radius: 1rem;
  box-shadow: var(--box-shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

.input-section {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  color: var(--text-dark);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.text-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 1.2rem;
  color: var(--text-dark);
  background: var(--bg-white);
  transition: all 0.3s ease;
  resize: vertical;
  min-height: 120px;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px hsla(202, 85%, 61%, 0.1);
}

.options-section {
  margin-bottom: 1.5rem;
}

.options-label {
  display: block;
  color: var(--text-dark);
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.option-tag {
  background: var(--bg-white);
  border: 2px solid #e2e8f0;
  color: var(--text-medium);
  padding: 0.75rem 1.25rem;
  border-radius: 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.option-tag:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.option-tag.selected {
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.option-tag.selected.furigana {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
}

.option-tag.selected.romaji {
  background: linear-gradient(
    135deg,
    var(--secondary) 0%,
    var(--secondary-2) 100%
  );
}

.option-tag.selected.both {
  background: linear-gradient(
    135deg,
    var(--tertiary) 0%,
    var(--tertiary-dark) 100%
  );
}

.generate-btn {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px hsla(202, 85%, 61%, 0.3);
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.loading.active {
  display: flex;
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #ffffff40;
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.result-card {
  background: var(--bg-white);
  border-radius: 1rem;
  box-shadow: var(--box-shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.result-card.hidden {
  display: none;
}

.result-header {
  background: linear-gradient(135deg, var(--primary-light-1) 0%, #e0f2fe 100%);
  padding: 1.25rem 2rem;
  border-bottom: 2px solid #e2e8f0;
}

.result-title {
  color: var(--text-dark);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.result-subtitle {
  color: var(--text-medium);
  font-size: 0.95rem;
}

.result-content {
  padding: 2rem;
}

.result-section {
  margin-bottom: 2rem;
}

.result-section:last-child {
  margin-bottom: 0;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.japanese-text {
  background: var(--primary-light-1);
  border: 2px solid hsla(202, 85%, 61%, 0.2);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 2;
  position: relative;
}

/* Furigana styling */
.furigana-text {
  font-size: 1.8rem;
  color: var(--text-dark);
  letter-spacing: 2px;
}

.char-with-furigana {
  display: inline-block;
  position: relative;
  margin: 0 2px;
}

.furigana-reading {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--primary-dark);
  font-weight: 500;
  white-space: nowrap;
}

/* Romaji styling */
.romaji-text {
  font-size: 1.4rem;
  color: var(--text-medium);
  font-style: italic;
  background: var(--secondary-0);
  border: 2px solid hsla(0, 69%, 67%, 0.2);
  border-radius: 0.75rem;
  padding: 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Combined styling */
.combined-text {
  font-size: 1.6rem;
  color: var(--text-dark);
  letter-spacing: 1px;
  line-height: 2.5;
}

.combined-char {
  display: inline-block;
  position: relative;
  margin: 0 3px 20px 3px;
}

.combined-furigana {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--primary-dark);
  font-weight: 500;
  white-space: nowrap;
}

.combined-romaji {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--secondary-2);
  font-style: italic;
  white-space: nowrap;
}

.copy-btn {
  background: var(--tertiary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.copy-btn:hover {
  background: var(--tertiary-dark);
  transform: translateY(-1px);
}
.copy-btn.copied {
  background: var(--success-color) !important;
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

.copy-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.examples-section {
  background: var(--bg-white);
  border-radius: 1rem;
  box-shadow: var(--box-shadow);
  padding: 2rem;
}

.section-label {
  color: var(--text-dark);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.example-item {
  background: var(--primary-light-1);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.example-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.example-japanese {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.example-meaning {
  color: var(--text-medium);
  font-size: 0.95rem;
  font-style: italic;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  #nihonez-primary .container {
    padding: 0 1rem;
  }

  .header h1 {
    font-size: 2rem;
  }

  .input-card,
  .result-content,
  .examples-section {
    padding: 1.5rem;
  }

  .option-tags {
    justify-content: center;
  }

  .furigana-text {
    font-size: 1.4rem;
  }

  .combined-text {
    font-size: 1.3rem;
  }

  .romaji-text {
    font-size: 1.2rem;
  }
}
