/* Story Creation Section */
.story-creation-section {
  max-width: 900px;
  margin: 0 auto;
  margin-top: var(--space-16);
  padding: var(--space-12) var(--space-6);
  position: relative;
  z-index: 2;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-creation-section.hidden {
  display: none;
}

.story-creation-section.expanding {
  display: block;
  opacity: 0;
  transform: translateY(-20px);
}

.story-creation-section.expanded {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.customization-header {
  text-align: center;
  margin: 0 calc(-1 * var(--space-6)) var(--space-6) calc(-1 * var(--space-6));
  padding: var(--space-6) var(--space-6);
  background: rgba(253, 251, 247, 0.9);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.customization-title {
  font-size: var(--text-3xl);
  color: var(--color-charcoal);
  margin-bottom: var(--space-3);
  font-family: var(--font-heading);
  font-weight: 600;
}

.customization-subtitle {
  font-size: var(--text-base);
  color: var(--color-gray-warm);
  margin: 0;
  line-height: 1.5;
}

/* Character Generate Section */
.character-generate-section {
  text-align: center;
  margin-top: var(--space-8);
  padding: var(--space-6);
  background: rgba(168, 181, 160, 0.05);
  border-radius: var(--radius-xl);
  border: 1px dashed rgba(168, 181, 160, 0.3);
}

.generate-divider {
  margin-bottom: var(--space-4);
}

.generate-divider .divider-text {
  font-size: var(--text-sm);
  color: var(--color-sage);
  font-weight: 600;
  font-family: var(--font-heading);
}

.character-generate-btn {
  background: linear-gradient(135deg, var(--color-sage) 0%, #98a890 100%);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.character-generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

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

.generate-note {
  font-size: var(--text-xs);
  color: var(--color-gray-soft);
  font-style: italic;
  margin: 0;
}

.story-creation-section {
  max-width: 900px;
  margin: 0 auto;
  margin-top: 0;
  padding: 0 var(--space-6);
  position: relative;
  z-index: 2;
}

.creation-panel {
  background: rgba(253, 251, 247, 0.6);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-2xl);
  padding: 0 var(--space-6) var(--space-4) var(--space-6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 20px 40px -12px rgba(0, 0, 0, 0.1),
    0 8px 24px -8px rgba(0, 0, 0, 0.05);
}

.customisation-section {
  margin-bottom: var(--space-5);
}

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

.keywords-section {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(168, 181, 160, 0.2);
}

.name-section {
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(168, 181, 160, 0.2);
}

.generate-section {
  padding-top: var(--space-3);
  text-align: center;
}

.step-connector {
  width: 2px;
  height: var(--space-4);
  background: linear-gradient(180deg, var(--color-sage), rgba(168, 181, 160, 0.3));
  margin: 0 auto var(--space-3) auto;
  border-radius: var(--radius-full);
}

.generate-section {
  text-align: center;
  padding: var(--space-3) 0;
}

.customization-section {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.customization-section.revealed {
  opacity: 1;
  transform: translateY(0);
}

.keywords-section {
  background: linear-gradient(135deg, rgba(168, 181, 160, 0.05) 0%, rgba(212, 165, 165, 0.05) 100%);
  border: 2px solid transparent;
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.keywords-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-2xl);
  padding: 2px;
  background: linear-gradient(45deg, var(--color-sage), var(--color-rose), var(--color-ochre));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0.3;
}

.keywords-container {
  position: relative;
  z-index: 1;
}

.keyword-suggestions {
  margin-top: var(--space-6);
}

.suggestions-label {
  font-size: var(--text-sm);
  color: var(--color-gray-warm);
  margin-bottom: var(--space-3);
  font-weight: 500;
}

.suggestion-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
  padding: var(--space-2);
  background: rgba(168, 181, 160, 0.02);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(168, 181, 160, 0.1);
  max-height: none;
  overflow: visible;
}

@media (max-width: 768px) {
  .suggestion-buttons {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-3);
  }
  
  .suggestion-btn {
    min-height: 52px;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-mobile-button);
    white-space: normal;
    text-align: center;
    line-height: var(--leading-normal-mobile);
    max-width: none;
  }
}

.suggestion-btn {
  background: rgba(253, 251, 247, 0.9);
  border: 1px solid var(--color-stone);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-charcoal);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 140px;
  word-wrap: break-word;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

@media (hover: hover) {
  .suggestion-btn:hover {
    background: rgba(168, 181, 160, 0.15);
    border-color: var(--color-sage);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(168, 181, 160, 0.2);
  }
}

.suggestion-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(168, 181, 160, 0.3);
}

.inspiration-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  min-height: 40px;
}

.inspiration-bubble {
  background: linear-gradient(135deg, var(--color-sage) 0%, #98a890 100%);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  animation: bubbleAppear 0.5s ease-out forwards;
}

.inspiration-bubble:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.inspiration-bubble:nth-child(1) { animation-delay: 0.1s; }
.inspiration-bubble:nth-child(2) { animation-delay: 0.2s; }
.inspiration-bubble:nth-child(3) { animation-delay: 0.3s; }
.inspiration-bubble:nth-child(4) { animation-delay: 0.4s; }
.inspiration-bubble:nth-child(5) { animation-delay: 0.5s; }

.name-section {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.generate-button {
  background: linear-gradient(135deg, var(--color-sage) 0%, #98a890 100%);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

@media (hover: hover) {
  .generate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
  }
}

.generate-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Compact Customisation Styles */
.customisation-compact {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.keywords-section-compact {
  margin-bottom: var(--space-8);
  padding: calc(var(--space-6) + 4px);
  background: rgba(255, 251, 245, 0.6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-sage);
  box-shadow: 0 4px 14px rgba(168, 181, 160, 0.15);
}

.section-title-compact {
  font-size: var(--text-xl);
  color: var(--color-charcoal);
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  font-weight: 600;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-gray-warm);
  margin-bottom: var(--space-4);
  font-style: italic;
}

.keywords-container-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.keywords-input-compact {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-stone);
  border-radius: var(--radius-lg);
  background: var(--color-linen);
  font-size: var(--text-base);
  transition: all 0.3s ease;
}

.keywords-input-compact:focus {
  outline: none;
  border-color: var(--color-sage);
  background: white;
  box-shadow: 0 0 0 3px rgba(168, 181, 160, 0.1);
}

.keyword-suggestions-compact {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.suggestions-label-compact {
  font-size: var(--text-sm);
  color: var(--color-gray-warm);
  margin-right: var(--space-2);
}

.keyword-btn {
  background: transparent;
  border: none;
  color: var(--color-sage);
  font-size: var(--text-sm);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  transition: all 0.2s ease;
}

.keyword-btn:hover {
  color: #8a9682;
  text-decoration: none;
}

.suggestion-separator {
  color: var(--color-stone);
  font-size: var(--text-xs);
}

.name-section-compact {
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: rgba(255, 251, 245, 0.5);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.name-section-title {
  font-size: var(--text-base);
  color: var(--color-charcoal);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.name-input-compact {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-stone);
  border-radius: var(--radius-lg);
  background: var(--color-linen);
  font-size: var(--text-base);
  transition: all 0.3s ease;
}

.name-input-compact:focus {
  outline: none;
  border-color: var(--color-sage);
  background: white;
  box-shadow: 0 0 0 3px rgba(168, 181, 160, 0.1);
}

.generate-section-compact {
  text-align: center;
}

.generate-button-compact {
  background: var(--color-sage);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-8);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  justify-content: center;
}

@media (hover: hover) {
  .generate-button-compact:hover:not(:disabled) {
    background: #98a890;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(168, 181, 160, 0.3);
  }
}

.generate-button-compact:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.generate-icon {
  font-size: var(--text-xl);
}

/* Mobile touch feedback */
@media (hover: none) {
  .suggestion-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .generate-button:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
  
  .generate-button-compact:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
  
  .character-generate-btn:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
}

/* Responsive Design for Compact Layout */
@media (max-width: 768px) {
  .customisation-compact {
    padding: var(--space-6);
  }
  
  .keyword-suggestions-compact {
    gap: var(--space-1);
  }
  
  .generate-button-compact {
    font-size: var(--text-mobile-button);
    padding: var(--space-4) var(--space-6);
    min-height: 60px;
  }
  
  .generate-button {
    font-size: var(--text-mobile-button);
    padding: var(--space-5) var(--space-8);
    min-height: 64px;
  }
}
