/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 50%, #f0fdf4 100%);
  min-height: 100vh;
  color: #1e293b;
  line-height: 1.5;
}

button {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: #c7d2fe;
  color: #3730a3;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Page visibility */
.page {
  display: block;
}

.page.hidden {
  display: none;
}

/* Generic hidden class */
.hidden {
  display: none !important;
}

/* NSFW-only elements (shown only in 18+ mode) */
.nsfw-only {
  transition: opacity 0.3s ease;
}

/* Landing Page Styles */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landing-hero {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 800px;
}

.landing-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.title-emoji {
  -webkit-text-fill-color: initial;
  font-size: 2.5rem;
}

.landing-subtitle {
  font-size: 1.5rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.landing-description {
  font-size: 1.1rem;
  color: #475569;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Mode Toggle Styles */
.mode-toggle {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

.mode-label {
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
  min-width: 2.5rem;
  text-align: center;
  user-select: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 30px;
  transition: background 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #dc2626 0%, #f97316 100%);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(26px);
}

.toggle-switch:hover .toggle-slider {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.toggle-switch:hover input:checked + .toggle-slider {
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.mode-description {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  min-height: 1.5em;
  transition: color 0.3s ease;
}

.mode-description.nsfw-active {
  color: #dc2626;
  font-weight: 500;
}

.start-button {
  font-size: 1.25rem;
  padding: 1rem 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.personality-preview {
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
}

.preview-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  color: #1e293b;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.type-card {
  padding: 1.5rem;
  border-radius: 16px;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.type-card:hover {
  transform: translateY(-4px);
}

.type-emoji {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 0.25rem;
}

.type-credit {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}

.type-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.type-tagline {
  font-size: 0.9rem;
  opacity: 0.9;
}

.traits-section {
  width: 100%;
  max-width: 1000px;
  padding: 4rem 2rem;
}

.traits-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  color: #1e293b;
}

.traits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.trait-card {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.trait-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.trait-card h3 {
  font-size: 1.25rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.trait-card p {
  color: #64748b;
  line-height: 1.5;
}

.how-it-works-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: #64748b;
}

.how-it-works-link a {
  color: #667eea;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.2s;
}

.how-it-works-link a:hover {
  color: #764ba2;
}

/* Methodology Page Styles */
.methodology-axes {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.methodology-axis h3 {
  font-size: 1rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  text-align: center;
}

.methodology-axis p {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.4rem;
}

.axis-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.axis-end {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 5.5rem;
}

.axis-end.axis-positive {
  text-align: right;
  color: #667eea;
}

.axis-end.axis-negative {
  text-align: left;
  color: #e879a0;
}

.axis-track {
  flex: 1;
  height: 6px;
  background: linear-gradient(90deg, #667eea 0%, #e2e8f0 50%, #e879a0 100%);
  border-radius: 3px;
  position: relative;
}

.axis-midpoint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #94a3b8;
  border-radius: 50%;
}

.methodology-type-table {
  margin-top: 1rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.methodology-type-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr 1fr 1fr;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

.methodology-type-row:last-child {
  border-bottom: none;
}

.methodology-type-row.header {
  background: #f8fafc;
  font-weight: 700;
  color: #1e293b;
}

.methodology-type-row:not(.header):nth-child(odd) {
  background: #fafbfc;
}

.methodology-adjective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.methodology-adjective {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.methodology-adjective h3 {
  font-size: 1rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.methodology-adjective p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}

.landing-footer {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  margin-top: auto;
}

/* Quiz Page Styles */
.quiz {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.quiz-container {
  width: 100%;
  max-width: 600px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.back-button {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}

.back-button:hover:not(:disabled) {
  color: #1e293b;
}

.back-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.question-counter {
  color: #64748b;
  font-weight: 600;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  transition: width 0.4s ease-out;
  width: 0%;
}

.question-card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: opacity 0.2s, transform 0.2s;
}

.question-card.transitioning {
  opacity: 0.7;
  transform: scale(0.98);
}

.question-text {
  font-size: 1.5rem;
  color: #1e293b;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.4;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.answer-button {
  width: 100%;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.answer-button:hover:not(:disabled) {
  border-color: #667eea;
  background: #f0f4ff;
  transform: translateX(4px);
}

.answer-button.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.answer-button:disabled {
  cursor: not-allowed;
}

.trait-indicator {
  text-align: center;
  margin-top: 1.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* Results Page Styles */
.results {
  min-height: 100vh;
  background: #f8fafc;
}

.results.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.results-container {
  max-width: 800px;
  margin: 0 auto;
}

.results-header {
  padding: 4rem 2rem;
  text-align: center;
  color: white;
}

.result-emoji {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
  animation: bounce 0.6s ease-out;
}

.result-emoji-img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
}

.result-credit {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

@keyframes bounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.result-name {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.result-tagline {
  font-size: 1.25rem;
  opacity: 0.95;
}

.result-adjective {
  font-size: 1.5rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  display: inline-block;
  margin-bottom: 0.75rem;
  backdrop-filter: blur(4px);
}

.results-content {
  padding: 2rem;
}

.result-section {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.result-section h2 {
  font-size: 1.25rem;
  color: #1e293b;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.description {
  color: #475569;
  line-height: 1.7;
  font-size: 1.05rem;
}

.traits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trait-tag {
  padding: 0.5rem 1rem;
  background: #f8fafc;
  border: 2px solid;
  border-radius: 50px;
  font-size: 0.9rem;
  color: #334155;
  font-weight: 500;
}

.trait-tag.nsfw-trait {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border-color: #f97316;
  color: #c2410c;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: #475569;
}

.list.strengths li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: bold;
}

.list.challenges li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #f59e0b;
}

.compatibility {
  text-align: center;
}

.compatible-types {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.compatible-card {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.compatible-emoji {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

.compatible-name {
  font-weight: 600;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.share-button,
.retake-button,
.home-button {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  border: none;
}

.share-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.share-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.retake-button {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.retake-button:hover {
  background: #f0f4ff;
}

.home-button {
  background: #f1f5f9;
  color: #64748b;
}

.home-button:hover {
  background: #e2e8f0;
}

/* Responsive Styles */
@media (max-width: 640px) {
  .landing-title {
    font-size: 2rem;
  }

  .title-emoji {
    font-size: 1.75rem;
  }

  .landing-subtitle {
    font-size: 1.25rem;
  }

  .result-adjective {
    font-size: 1.25rem;
    padding: 0.4rem 1rem;
  }

  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quiz {
    padding: 1rem;
  }

  .question-card {
    padding: 1.5rem;
    border-radius: 16px;
  }

  .question-text {
    font-size: 1.25rem;
  }

  .answer-button {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  .results-header {
    padding: 3rem 1.5rem;
  }

  .result-emoji-img {
    width: 120px;
    height: 120px;
  }

  .result-name {
    font-size: 2rem;
  }

  .results-content {
    padding: 1rem;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .compatible-types {
    flex-direction: column;
    align-items: center;
  }

  .methodology-type-row {
    grid-template-columns: 1fr 1.5fr 1fr 1fr 1fr;
    font-size: 0.75rem;
    padding: 0.5rem 0.5rem;
  }

  .axis-end {
    font-size: 0.75rem;
    min-width: 4rem;
  }
}
