:root {
  /* Light Theme Variables */
  --bg-main: #f3f4f6;
  --bg-gradient: radial-gradient(circle at 15% 50%, rgba(200, 150, 255, 0.4), transparent 50%),
                 radial-gradient(circle at 85% 30%, rgba(100, 200, 255, 0.4), transparent 50%),
                 radial-gradient(circle at 50% 80%, rgba(255, 150, 200, 0.4), transparent 50%);
  --bg-sidebar: #F7F8FA;
  --bg-card: rgba(255, 255, 255, 0.25);
  --bg-card-hover: rgba(255, 255, 255, 0.4);
  --border-color: rgba(255, 255, 255, 0.4);
  --shadow-card: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --text-primary: #1A1A1A;
  --text-secondary: rgba(0, 0, 0, 0.6);
  --accent-color: #09090b;
  --accent-text: #ffffff;
  --gradient-avatar: linear-gradient(135deg, #e4e4e7 0%, #a1a1aa 100%);
  --pill-bg: rgba(255, 255, 255, 0.3);
  --pill-text: #1A1A1A;
}

.dark-mode {
  /* Dark Theme Variables */
  --bg-main: #0F172A;
  --bg-gradient: radial-gradient(circle at 15% 50%, rgba(30, 27, 75, 0.8), transparent 50%),
                 radial-gradient(circle at 85% 30%, rgba(15, 23, 42, 0.9), transparent 50%),
                 radial-gradient(circle at 50% 80%, rgba(40, 20, 60, 0.6), transparent 50%);
  --bg-sidebar: #121214;
  --bg-card: rgba(15, 23, 42, 0.4);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);
  --text-primary: #F8FAFC;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --accent-color: #ffffff;
  --accent-text: #000000;
  --gradient-avatar: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --pill-bg: rgba(15, 23, 42, 0.4);
  --pill-text: #F8FAFC;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-primary);
  transition: color 0.3s ease, background-color 0.3s ease;
  line-height: 1.6;
}

/* Layout */
.layout-container {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 0 0 70%;
  padding: 4rem 10%;
  display: flex;
  flex-direction: column;
}

.sidebar {
  flex: 0 0 30%;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-left: 1px solid var(--border-color);
  padding: 4rem 3rem;
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Top Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--text-secondary);
}

.theme-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.theme-btn:hover {
  background-color: var(--bg-card);
}

.icon {
  width: 20px;
  height: 20px;
}

.hidden {
  display: none;
}

/* Views */
.view {
  display: none;
  flex: 1;
  animation: fadeIn 0.4s ease forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quiz Content */
.question-title {
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 2rem;
  letter-spacing: -0.03em;
  text-align: center;
}



.question-item {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  transition: all 0.5s ease-in-out;
}

.question-item.blurred {
  filter: blur(6px);
  opacity: 0.4;
  transform: scale(0.96);
}

.question-item.focused {
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
}



.question-item:last-child {
  margin-bottom: 0;
}

.unanswered-highlight {
  animation: softFlash 1s ease;
}

@keyframes softFlash {
  0% { background-color: transparent; }
  20% { background-color: rgba(239, 68, 68, 0.1); }
  100% { background-color: transparent; }
}

.likert-scale {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.likert-label {
  font-size: 13px;
  font-weight: 500;
  width: 60px;
  letter-spacing: 2px;
}

.likert-label.agree {
  color: var(--text-secondary);
  text-align: right;
}

.likert-label.disagree {
  color: var(--text-secondary);
  text-align: left;
}

.likert-circles {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.likert-circle {
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base sizes */
.circle-l { width: 55px; height: 55px; }
.circle-m { width: 45px; height: 45px; }
.circle-s { width: 35px; height: 35px; }

/* Colors and states */
.circle-agree:hover, .circle-agree.selected {
  background-color: #33a474;
  border-color: #33a474;
  box-shadow: 0 0 15px rgba(51, 164, 116, 0.6);
  transform: scale(1.05);
}

.circle-neutral:hover, .circle-neutral.selected {
  background-color: #9ca3af;
  border-color: #9ca3af;
  box-shadow: 0 0 15px rgba(156, 163, 175, 0.6);
  transform: scale(1.05);
}

.circle-disagree:hover, .circle-disagree.selected {
  background-color: #88619a;
  border-color: #88619a;
  box-shadow: 0 0 15px rgba(136, 97, 154, 0.6);
  transform: scale(1.05);
}

/* Sidebar Quiz */
.sidebar-content {
  display: none;
  height: calc(100vh - 80px); /* Fill remaining height for sticky layout */
  flex-direction: column;
  position: sticky;
  top: 40px;
}

.sidebar-content.active {
  display: flex;
  animation: fadeIn 0.4s ease forwards;
}

.top-progress-wrapper {
  margin-top: auto; /* Pushes progress to the bottom of the sidebar */
  margin-bottom: 2rem;
}

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: block;
  font-weight: 500;
}

.progress-bar-bg {
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--accent-color);
  width: 0%; /* Initialize at 0% */
  transition: width 0.4s ease-in-out;
}

.sidebar-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.sidebar-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.sidebar-quote {
  font-style: italic;
  color: #9ca3af;
  font-size: 0.95rem;
  margin-top: 1rem;
}

.sidebar-art {
  position: relative;
  height: 120px;
  margin-bottom: 2rem;
}

.art-circle {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: multiply;
  filter: blur(8px);
  opacity: 0.8;
}

.art-circle-1 {
  width: 80px; height: 80px; background: #dbeafe; top: 10px; left: 0px;
}

.art-circle-2 {
  width: 60px; height: 60px; background: #fce7f3; top: 40px; left: 50px;
}

.art-circle-3 {
  width: 70px; height: 70px; background: #fef3c7; top: 0px; left: 70px;
}

.dark-mode .art-circle { mix-blend-mode: screen; opacity: 0.4; }
.dark-mode .art-circle-1 { background: #3730a3; }
.dark-mode .art-circle-2 { background: #9d174d; }
.dark-mode .art-circle-3 { background: #92400e; }

/* Result Content */
.result-heading {
  font-size: 2.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.result-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

.traits-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.pill-badge {
  background: var(--pill-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.pill-badge:hover {
  border-color: var(--text-secondary);
  transform: translateY(-1px);
}

/* Sidebar Result */
.avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gradient-avatar);
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.personality-identity {
  margin-bottom: 3rem;
}

.type-code {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.type-title {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 1rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all 0.2s ease;
  position: relative;
  display: inline-block;
  padding-left: 14px;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: transparent;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--text-primary);
  font-weight: 600;
}

.nav-link.active::before {
  background-color: var(--text-primary);
}

.result-detail-text {
  margin-top: 3rem;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 16px;
}

.result-detail-text.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.result-detail-text.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Glassmorphism scrollbar */
.result-detail-text::-webkit-scrollbar {
  width: 6px;
}
.result-detail-text::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.result-detail-text::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.result-detail-text::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
}

.ghost-btn {
  width: 100%;
  padding: 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.ghost-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    overscroll-behavior-y: none;
  }
  .layout-container {
    flex-direction: column;
  }
  .main-content {
    flex: none;
    padding: 1.5rem 1rem;
    min-height: auto;
  }
  .question-item {
    padding: 24px 16px;
  }
  .question-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
  .sidebar {
    flex: none;
    padding: 2rem 1.5rem;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
  .sidebar-content {
    height: auto;
    position: static;
  }
  .avatar-placeholder {
    width: 80px;
    height: 80px;
  }
  .likert-circles {
    gap: 0.5rem;
  }
  .likert-circle {
    margin: 4px;
  }
  .circle-l { width: 48px; height: 48px; }
  .circle-m { width: 40px; height: 40px; }
  .circle-s { width: 32px; height: 32px; }
  .likert-label {
    display: none;
  }
  .likert-scale {
    gap: 0.25rem;
  }
}

/* Pagination Transitions */
.question-list {
  transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
  opacity: 1;
  transform: translateY(0);
}

.question-list.fade-out {
  opacity: 0;
  transform: translateY(15px);
}

.question-list.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Welcome View */
.welcome-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  max-width: 800px;
  margin: 2rem auto;
  text-align: center;
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease, border-color 0.3s ease;
}

.welcome-heading {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3rem;
  letter-spacing: -0.03em;
}

.welcome-rules {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 4rem;
  text-align: left;
  width: 100%;
  max-width: 500px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.rule-icon {
  font-size: 1.5rem;
  line-height: 1.2;
}

.rule-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.welcome-btn {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 99px;
  padding: 1.2rem 4rem;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 8px 32px var(--shadow-card);
  animation: pulseGlow 3s infinite alternate;
}

.welcome-btn:hover {
  transform: scale(1.05);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2);
}


  100% { box-shadow: 0 4px 25px rgba(255, 255, 255, 0.5), 0 8px 32px rgba(31, 38, 135, 0.15); }
}

.welcome-container.fade-out {
  opacity: 0;
  transform: translateY(20px);
}


.flash-glow {
  animation: barFlash 0.5s ease-out;
}
@keyframes barFlash {
  0% { box-shadow: 0 0 5px var(--accent-color); filter: brightness(1); }
  50% { box-shadow: 0 0 20px var(--accent-color); filter: brightness(1.5); }
  100% { box-shadow: 0 0 0 transparent; filter: brightness(1); }
}
