@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Outfit:wght@300;400;600;700;900&display=swap');

/* --- Theme System (Pop & Playful with Soft Celestial Gradient) --- */
:root {
  /* Fonts */
  --font-main: 'Noto Sans JP', sans-serif;
  --font-accent: 'Outfit', sans-serif;

  /* Colors */
  --color-brand: #1b75ff; /* TeamRealise Blue */
  --color-brand-hover: #0056c6;
  --color-accent: #fd79a8;
  --color-bg-start: #a29bfe; /* Rich periwinkle blue-purple */
  --color-bg-end: #cfe2fe;   /* Pastel sky-blue matching the logo */
  --color-text: #2d3436;
  --color-text-muted: #636e72;
  --color-card-bg: rgba(255, 255, 255, 0.9);
  --color-card-border: #ffffff;
  
  /* Buttons & Inputs */
  --color-neutral: #dfe6e9;
  --color-agree-dark: #2ecc71;
  --color-agree-light: #abf1c6;
  --color-disagree-dark: #ff7675;
  --color-disagree-light: #ffcdcc;

  /* Sizes */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-circle: 50%;
  
  /* Shadows & Borders */
  --border-thick: 3px solid #2d3436;
  --border-thin: 1.5px solid #2d3436;
  --shadow-flat: 6px 6px 0px #2d3436;
  --shadow-flat-small: 3px 3px 0px #2d3436;
  --shadow-hover: 10px 10px 0px #2d3436;
  --shadow-soft: 0 15px 35px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-speed: 0.25s;
  --transition-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
  font-family: var(--font-main);
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* Background sparkles */
body::before, body::after {
  content: "✦";
  position: absolute;
  font-size: 24px;
  color: var(--color-accent);
  opacity: 0.3;
  animation: float 4s ease-in-out infinite;
}
body::before { top: 10%; left: 10%; animation-delay: 0s; }
body::after { bottom: 15%; right: 10%; animation-delay: 2s; }

/* --- Container & Layout --- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  z-index: 10;
}

.screen {
  display: none;
  animation: slideIn var(--transition-speed) var(--transition-bounce) forwards;
}

.screen.active {
  display: block;
}

/* --- Card Styles (Neo-brutalism Pop Art Fusion) --- */
.card {
  background: var(--color-card-bg);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-flat);
  padding: 40px;
  margin-bottom: 24px;
  transition: transform var(--transition-speed) var(--transition-bounce), 
              box-shadow var(--transition-speed) var(--transition-bounce);
  backdrop-filter: blur(10px);
}

.card:hover {
  transform: translate(-4px, -4px);
  box-shadow: var(--shadow-hover);
}

/* --- Typography --- */
h1 {
  font-family: var(--font-accent);
  font-weight: 900;
  font-size: 2.8rem;
  text-transform: uppercase;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--color-text);
  text-shadow: 2px 2px 0px #fff, 4px 4px 0px var(--color-brand);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 30px;
  font-weight: 500;
}

/* --- Welcome Screen --- */
.welcome-card {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.welcome-card img {
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  animation: spinSlow 20s linear infinite;
}

.welcome-intro {
  margin-bottom: 30px;
  line-height: 1.6;
  font-size: 1.05rem;
}

.input-group {
  margin-bottom: 25px;
  text-align: left;
}

.input-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.input-text {
  width: 100%;
  padding: 16px 20px;
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 500;
  border: var(--border-thick);
  border-radius: var(--radius-md);
  outline: none;
  background: white;
  transition: all 0.2s;
}

.input-text:focus {
  background: #fbfbfe;
  border-color: var(--color-brand);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 36px;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  background: var(--color-brand);
  color: white;
  border: var(--border-thick);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat-small);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-flat);
  background: var(--color-brand-hover);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000;
}

.btn-secondary {
  background: white;
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-neutral);
}

/* --- Test Screen --- */
.progress-container {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.progress-text {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.progress-bar-bg {
  flex-grow: 1;
  height: 16px;
  background: var(--color-neutral);
  border: var(--border-thin);
  border-radius: 30px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-brand), var(--color-accent));
  border-radius: 30px;
  transition: width 0.3s ease;
}

.question-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.question-text {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.6;
  margin: 30px 0;
  width: 100%;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* Five-point choice layout */
.choice-container {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 10px 0;
  position: relative;
}

.choice-line {
  position: absolute;
  left: 30px;
  right: 30px;
  height: 4px;
  background: var(--color-neutral);
  z-index: 1;
  border-radius: 2px;
}

.choice-option {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--transition-bounce);
}

.choice-option:hover {
  transform: scale(1.15);
}

.choice-circle {
  border: var(--border-thick);
  border-radius: var(--radius-circle);
  background: white;
  transition: all 0.2s;
}

/* Choice Circle Sizes & Colors */
/* Strongly Agree */
.choice-option[data-value="2"] .choice-circle {
  width: 54px;
  height: 54px;
}
.choice-option[data-value="2"]:hover .choice-circle,
.choice-option[data-value="2"].selected .choice-circle {
  background: var(--color-agree-dark);
}

/* Agree */
.choice-option[data-value="1"] .choice-circle {
  width: 44px;
  height: 44px;
}
.choice-option[data-value="1"]:hover .choice-circle,
.choice-option[data-value="1"].selected .choice-circle {
  background: var(--color-agree-light);
}

/* Neutral */
.choice-option[data-value="0"] .choice-circle {
  width: 34px;
  height: 34px;
}
.choice-option[data-value="0"]:hover .choice-circle,
.choice-option[data-value="0"].selected .choice-circle {
  background: #b2bec3;
}

/* Disagree */
.choice-option[data-value="-1"] .choice-circle {
  width: 44px;
  height: 44px;
}
.choice-option[data-value="-1"]:hover .choice-circle,
.choice-option[data-value="-1"].selected .choice-circle {
  background: var(--color-disagree-light);
}

/* Strongly Disagree */
.choice-option[data-value="-2"] .choice-circle {
  width: 54px;
  height: 54px;
}
.choice-option[data-value="-2"]:hover .choice-circle,
.choice-option[data-value="-2"].selected .choice-circle {
  background: var(--color-disagree-dark);
}

.choice-label-wrapper {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin: 12px auto 0 auto;
}

.choice-side-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.choice-side-label.agree-label { color: #27ae60; }
.choice-side-label.disagree-label { color: #c0392b; }

/* Navigation buttons (Prev / Next) */
.test-navigation {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 30px;
  gap: 15px;
}

/* --- Result Screen --- */
.result-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 800px) {
  .result-layout {
    grid-template-columns: 1fr;
  }
}

/* Tarot Card CSS */
.tarot-card-container {
  display: flex;
  justify-content: center;
  margin: 0 auto 30px auto;
  perspective: 1000px;
}

.tarot-card {
  width: 300px;
  height: 530px;
  background: #ffffff;
  border: 8px double #d4af37; /* Elegant double border like user pic */
  outline: var(--border-thick);
  border-radius: 12px;
  box-shadow: var(--shadow-flat);
  position: relative;
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: #faf7f2;
  transition: transform 0.6s var(--transition-bounce), box-shadow 0.6s;
  transform-style: preserve-3d;
}

.tarot-card:hover {
  transform: rotateY(10deg) rotateX(10deg) translateY(-8px);
  box-shadow: 12px 20px 0px #2d3436;
}

/* Tarot Card Inner Elements */
.tarot-stars {
  font-family: var(--font-accent);
  color: #d4af37;
  font-size: 1.4rem;
  letter-spacing: 5px;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
  margin-bottom: 5px;
  z-index: 2;
}

.tarot-frame {
  flex-grow: 1;
  width: 100%;
  border: 2px solid #d4af37;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #fffcf5 0%, #e8e3d9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tarot-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.tarot-card:hover .tarot-image {
  transform: scale(1.05);
}

.tarot-banner {
  width: 105%;
  background: white;
  border: var(--border-thick);
  border-radius: 8px;
  padding: 6px 12px;
  text-align: center;
  box-shadow: 0 4px 0px #2d3436;
  position: relative;
  bottom: -5px;
  z-index: 5;
  transform: rotate(-1.5deg);
}

.tarot-title {
  font-family: var(--font-accent);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--color-text);
  line-height: 1.2;
}

.tarot-subtitle {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Result Info Panel */
.result-header {
  margin-bottom: 25px;
}

.result-user-greet {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-brand);
  margin-bottom: 5px;
}

.result-type-name {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  border: var(--border-thin);
  border-radius: 30px;
  color: white;
  margin-bottom: 15px;
}

/* Metrics and Bars */
.metrics-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.metric-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metric-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.metric-bar-wrapper {
  height: 18px;
  background: var(--color-neutral);
  border: var(--border-thin);
  border-radius: 20px;
  display: flex;
  overflow: hidden;
  position: relative;
}

.metric-bar-left {
  height: 100%;
  background: var(--color-brand);
  transition: width 0.8s ease-in-out;
}

.metric-bar-right {
  height: 100%;
  background: var(--color-accent);
  transition: width 0.8s ease-in-out;
  margin-left: auto;
}

.metric-center-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--color-text);
  opacity: 0.5;
  z-index: 2;
}

/* Radar Chart */
.chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 30px 0;
  border: var(--border-thin);
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  padding: 20px;
}

.radar-chart-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

/* Detailed Texts */
.desc-section {
  margin-bottom: 25px;
  line-height: 1.7;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: "✦";
  color: var(--color-brand);
}

.strengths-weaknesses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 25px 0;
}

@media (max-width: 600px) {
  .strengths-weaknesses {
    grid-template-columns: 1fr;
  }
}

.list-box {
  border: var(--border-thin);
  border-radius: var(--radius-md);
  padding: 20px;
  background: white;
}

.list-box.strengths-box {
  background-color: #f6ffed;
  border-color: #b7eb8f;
}

.list-box.weaknesses-box {
  background-color: #fff1f0;
  border-color: #ffa39e;
}

.list-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-box ul {
  list-style: none;
}

.list-box li {
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.strengths-box li::before {
  content: "✓";
  color: #52c41a;
  font-weight: 900;
}

.weaknesses-box li::before {
  content: "⚠";
  color: #ff4d4f;
  font-weight: 900;
}

/* Careers and Compatibility */
.careers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 25px;
}

.career-tag {
  background: white;
  border: var(--border-thin);
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 2px 2px 0px #2d3436;
}

.compatibility-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.compat-card {
  border: var(--border-thin);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.compat-card.best-compat {
  background: #e6ffed;
  border-color: #b7eb8f;
}

.compat-card.worst-compat {
  background: #fff0f6;
  border-color: #ffadd2;
}

.compat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.compat-type {
  font-size: 1.2rem;
  font-weight: 900;
}

.compat-tag {
  font-size: 0.8rem;
  background: white;
  border: var(--border-thin);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Footer / Action buttons */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 40px;
}

.share-banner {
  background: #e3eeff;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 15px;
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

/* --- Shared Results Backlink Header --- */
.shared-backlink-banner {
  background: var(--color-brand);
  color: white;
  text-align: center;
  padding: 12px 20px;
  font-weight: 700;
  border: var(--border-thick);
  border-radius: var(--radius-md);
  margin-bottom: 25px;
  box-shadow: var(--shadow-flat-small);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.shared-backlink-banner p {
  margin: 0;
}

.shared-backlink-banner .btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  box-shadow: 2px 2px 0px #2d3436;
}

/* --- Theme overrides based on personality group --- */
.theme-green {
  --color-brand: #4caf50;
  --color-brand-hover: #388e3c;
  --color-accent: #81c784;
}

.theme-purple {
  --color-brand: #9b5de5;
  --color-brand-hover: #7209b7;
  --color-accent: #f15bb5;
}

.theme-blue {
  --color-brand: #2196f3;
  --color-brand-hover: #0b7dda;
  --color-accent: #00b4d8;
}

.theme-yellow {
  --color-brand: #fbc02d;
  --color-brand-hover: #f57c00;
  --color-accent: #ffeb3b;
  --color-text: #2d3436; /* make sure text remains readable */
}

/* --- Animations --- */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(10deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* Loader styling */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--color-neutral);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Personality Directory Grid --- */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 15px;
}

@media (max-width: 768px) {
  .directory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .directory-grid {
    grid-template-columns: 1fr;
  }
}

.directory-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-flat-small);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
}

.directory-item:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0px #2d3436;
}

.directory-item:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #2d3436;
}

.directory-item.group-diplomat {
  background: #abf1c6;
}
.directory-item.group-diplomat:hover {
  background: #9deab9;
}

.directory-item.group-analyst {
  background: #ebd3ff;
}
.directory-item.group-analyst:hover {
  background: #dfbcff;
}

.directory-item.group-sentinel {
  background: #b3e5fc;
}
.directory-item.group-sentinel:hover {
  background: #9fe0ff;
}

.directory-item.group-explorer {
  background: #fff4b3;
}
.directory-item.group-explorer:hover {
  background: #ffe391;
}

.directory-item .item-code {
  font-family: var(--font-accent);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.directory-item .item-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(45, 52, 54, 0.8);
  margin-top: 3px;
}

/* --- Mobile Responsiveness Adjustments --- */
@media (max-width: 600px) {
  .card {
    padding: 28px 20px; /* Reduce side padding so content has more room */
    border-radius: var(--radius-md);
  }
  .question-text {
    font-size: 1.15rem; /* Slightly smaller text for better layout on mobile */
    margin: 20px 0;
  }
  .choice-container {
    padding: 5px 0;
  }
  /* Scale down the 5 choice circles slightly to prevent overlap */
  .choice-option[data-value="2"] .choice-circle,
  .choice-option[data-value="-2"] .choice-circle {
    width: 44px;
    height: 44px;
  }
  .choice-option[data-value="1"] .choice-circle,
  .choice-option[data-value="-1"] .choice-circle {
    width: 36px;
    height: 36px;
  }
  .choice-option[data-value="0"] .choice-circle {
    width: 28px;
    height: 28px;
  }
  .choice-line {
    left: 20px;
    right: 20px;
    height: 3px;
  }
}
