:root {
  /* Mystic Valley Palette (Monument Valley Style) */
  --primary: #4ECDC4;
  /* Teal / Turquoise */
  --primary-dark: #2980B9;
  /* Deep Ocean */
  --secondary: #FF6B6B;
  /* Sunset Red */
  --accent: #FFE66D;
  /* Soft Yellow */

  --bg-gradient-start: #2E2B5F;
  /* Deep Purple */
  --bg-gradient-end: #FF6B8B;
  /* Soft Pink */

  /* Text Colors */
  --text-main: #2C3E50;
  --text-light: #95A5A6;
  --text-on-dark: #FFFFFF;
  --text-primary: #2C3E50;
  /* Add alias for consistency */
  --text-secondary: #7F8C8D;
  /* Add alias for consistency */

  /* Components */
  --card-bg: rgba(255, 255, 255, 0.95);
  --border-radius: 20px;
  --surface-hover: #F0F7F4;
  /* Light mint hover */

  /* Isometric Shadows */
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.1), 0 16px 20px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 0 rgba(0, 0, 0, 0.1), 0 8px 10px rgba(0, 0, 0, 0.1);

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "微软雅黑", "SimHei", "黑体", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-on-dark);
  /* White text on gradient */
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: transparent;
  /* Let body gradient show through */
  position: relative;
  border-left: none;
  border-right: none;
  /* Add subtle grain or pattern overlay if desired */
}

/* Typography Overrides */
h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-on-dark);
  margin-bottom: var(--spacing-sm);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--text-main);
  /* Dark inside cards usually */
}

.subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  /* Light subtitle on background */
  font-weight: 500;
}

/* Progress Bar - Floating Pill */
.progress-container {
  position: sticky;
  top: 10px;
  background: transparent;
  z-index: 100;
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.progress-bar {
  height: 12px;
  background: rgba(0, 0, 0, 0.2);
  /* Darker track for visibility */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  margin-bottom: 4px;
  /* Space for steps text */
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
  width: 0%;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(255, 230, 109, 0.3);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  padding: 0 4px;
  /* Align with rounded bar ends */
}

.page {
  display: none;
  /* hidden by default */
  min-height: 100vh;
  /* occupy full viewport height */
  flex-direction: column;
  /* stack header, content, footer */
  padding: var(--spacing-md);
  padding-bottom: 100px;
  /* extra space for bottom nav */
}

.page.active {
  display: flex;
  /* show active page as flex container */
  flex-direction: column;
}

/* Ensure page content scrolls and leaves space for fixed nav buttons */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  padding-bottom: 100px;
  /* extra space for bottom nav */
}


.page-header {
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

/* Buttons */
/* Buttons - Isometric Style */
.btn {
  border: none;
  border-radius: 12px;
  /* Slightly squarer for isometric feel */
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: none !important;
  /* Collapse shadow on press */
}

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

.btn-primary:active {
  background-color: var(--primary);
  box-shadow: 0 4px 0 #95A5A6;
}

.btn-back {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: none;
  font-weight: 600;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn:disabled,
.btn-disabled {
  background: #BDC3C7;
  color: white;
  box-shadow: 0 4px 0 #95A5A6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 6px 0 #CB8C0F, 0 5px 5px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
  box-shadow: 0 0 0 #BDC3C7, inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}



.nav-buttons {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: var(--spacing-md);
  /* Glass gradient for nav area */
  background: linear-gradient(to top, rgba(46, 43, 95, 0.95) 0%, rgba(46, 43, 95, 0) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 90;
}

/* Cards & Inputs - Privacy Glass / Cloud Blocks */
.card {
  background: var(--card-bg);
  /* Semi transparent white */
  color: var(--text-main);
  /* Enforce dark text inside cards */
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
}

/* Decision Types Grid */
.decision-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.type-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 6px 0 #BDC3C7, 0 10px 10px rgba(0, 0, 0, 0.1);
  /* Isometric Block */
  transition: all 0.1s;
  cursor: pointer;
  color: var(--text-main);
  height: 100%;
  min-height: 140px;
  justify-content: center;
}

.type-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 #BDC3C7, inset 0 2px 4px rgba(0, 0, 0, 0.1);
}



.type-btn.selected {
  outline: 2px solid var(--primary);
  background-color: #f0f7f4;
}

/* Geometric Icons (Monument Style) */
.geo-icon {
  width: 60px;
  height: 60px;
  position: relative;
  margin-bottom: var(--spacing-sm);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shape-circle,
.shape-square,
.shape-triangle,
.shape-dome,
.shape-diamond {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.shape-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
}

.shape-square {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--secondary);
  box-shadow: 0 4px 0 #E74C3C;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 34px solid var(--accent);
  filter: drop-shadow(0 4px 0 #F1C40F);
}

.shape-dome {
  width: 38px;
  height: 30px;
  background: #9B59B6;
  /* Purple */
  border-radius: 50px 50px 0 0;
  box-shadow: 0 4px 0 #8E44AD;
}

.type-btn:hover .geo-icon {
  transform: translateY(-8px) scale(1.1);
}

.type-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-main);
}

.type-desc {
  font-size: 10px;
  color: var(--text-light);
}

/* Custom Input */
.custom-input-container {
  background: var(--card-bg);
  color: var(--text-main);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-top: var(--spacing-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.4);
}


.custom-input-container input {
  width: 100%;
  padding: 16px;
  border: none;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px 8px 0 0;
  margin: var(--spacing-sm) 0;
  font-size: 16px;
  color: var(--text-main);
  transition: all 0.3s;
}

.custom-input-container input:focus {
  outline: none;
  border-bottom-color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
}

/* Factors List */
.factor-item {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  color: var(--text-main);
  padding: 12px var(--spacing-md);
  border-radius: 12px;
  margin-bottom: var(--spacing-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  animation: slideIn 0.3s ease;
  padding-left: 25px;
  padding-right: 25px;
}

.factor-item input {
  flex: 1;
  border: none;
  font-size: 15px;
  color: var(--text-main);
  background: transparent;
}

.factor-item input:focus {
  outline: none;
}

.btn-delete-factor {
  background: none;
  border: none;
  color: #ff8a80;
  font-size: 18px;
  padding: 4px 8px;
}

.add-factor-container {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.add-factor-container input {
  flex: 1;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 20px;
  padding-left: 16px;
}

/* Factor Suggestions */
.factors-suggestion {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  animation: fadeIn 0.4s ease;
}

.suggestion-title {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: var(--spacing-sm);
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fcfcfc;
}

.suggestion-chip span {
  font-size: 16px;
  line-height: 1;
  color: var(--primary);
}



.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.slider-value {
  color: var(--secondary);
  font-weight: 800; 
  font-size: 26px;
  min-width: 45px;
  text-align: right;
  flex-shrink: 0;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), 0 0 10px var(--accent);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.1);
}

/* Options Input */
.options-input-section {
  background: var(--card-bg);
  color: var(--text-main);
  /* Enforce dark text */
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.option-input-row {
  display: flex;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.option-input {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-remove-option {
  background: none;
  border: none;
  color: #E74C3C;
  font-size: 20px;
  padding: 0 12px;
  cursor: pointer;
}

.btn-small {
  font-size: 11px;
  padding: 6px 14px;
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Scoring - Floating Islands */
.scoring-tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  overflow-x: auto;
  padding-bottom: 8px;
  /* Scrollbar space */
}

.scor-tab {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.scor-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(78, 205, 196, 0.4);
  border-color: transparent;
}

.score-item {
  background: var(--card-bg);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-sm);
  border-left: 6px solid var(--secondary);
  box-shadow: var(--shadow-hover);
  transition: transform 0.2s;
}

.score-item:hover {
  transform: translateY(-2px);
}

.score-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-main);
}

.scoring-tip {
  font-size: 13px;
}

/* Results */
/* Results - Monument Blocks */
.result-card {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.1), 0 12px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  border: 4px solid white;
  /* Thick border */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-card:hover {
  transform: translateY(-5px);
}

.result-card.winner {
  border: 4px solid var(--accent);
  /* Golden border for winner */
  background: linear-gradient(135deg, white 0%, #FFF9C4 100%);
}

.result-card.winner::after {
  content: 'BEST CHOICE';
  position: absolute;
  top: 16px;
  right: -30px;
  background: var(--accent);
  color: #B7950B;
  padding: 6px 30px;
  transform: rotate(45deg);
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}



.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--spacing-sm);
}

.result-score {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.result-bar-container {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  background: var(--gradient-primary);
  width: 0;
  transition: width 1s ease;
}

/* Intuition */
.intuition-choices {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.intuition-btn {
  background: var(--card-bg);
  padding: var(--spacing-lg);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
}

.intuition-btn.selected {
  border-color: var(--accent);
  background-color: #fff5f5;
  color: var(--accent);
}

/* Analysis */
.analysis-card {
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  line-height: 1.8;
}

.match-status {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.status-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-sm);
  display: block;
}

.suggestion-item {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  border-left: 3px solid var(--primary);
}

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

/* Score Table */
.score-table-section {
  margin-top: var(--spacing-xl);
  background: var(--card-bg);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: white;
}

.score-table thead {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.score-table th {
  padding: 10px 8px;
  text-align: center;
  font-weight: 500;
  white-space: nowrap;
}

.score-table th:first-child {
  text-align: left;
  min-width: 100px;
}

.score-table td {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
}

.score-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-main);
}

.score-table tbody tr:hover {
  background-color: #fafafa;
}

.score-table input[type="number"] {
  width: 45px;
  padding: 4px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
}

.score-table input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
}

.importance-cell {
  background-color: #f9f9f9;
  font-weight: 600;
  color: var(--primary);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* History Button (Fixed at top) */
.history-btn-wrapper {
  position: relative;
  z-index: 101;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 12px;
}

.history-btn-wrapper.hidden {
  display: none;
}

/* Ranking Visual for Step 3 */
.ranking-visual-container {
  margin: 24px 0;
  padding: 16px 0;
}

.ranking-list {
  display: flex;
  flex-direction: column;
}

/* Importance Sliders - Magic Tracks */
.importance-item {
  font-weight: 500;
  background: var(--card-bg);
  color: var(--text-main);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  padding-left: 30px;
  padding-right: 30px;
  font-size: 14px;
}

/* Ranking indicators for Step 3 */
.importance-item:nth-child(1) {
  border-left: 4px solid var(--primary) !important;
  z-index: 10;
}

.importance-item:nth-child(2) {
  border-left: 3px solid #81C784 !important;
  z-index: 9;
}

.importance-item:nth-child(3) {
  border-left: 2px solid #A5D6A7 !important;
  z-index: 8;
}

.ranking-item .rank-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
  margin-right: 16px;
  flex-shrink: 0;
  z-index: 1;
  background: #e0e0e0;
  color: #666;
}

.ranking-item:nth-child(1) .rank-number {
  background: var(--primary);
  color: white;
}

.ranking-item:nth-child(2) .rank-number {
  background: #81C784;
  color: white;
}

.ranking-item:nth-child(3) .rank-number {
  background: #A5D6A7;
  color: white;
}

.ranking-item:nth-child(n+4) .rank-number {
  background: #e0e0e0;
  color: #666;
}

.ranking-item .factor-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-right: 10px;
}

.ranking-item .factor-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.ranking-item .factor-importance {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-dark);
  background: rgba(78, 205, 196, 0.2);
  padding: 6px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ranking indicators */
.ranking-item:nth-child(1) {
  position: relative;
}

.ranking-item:nth-child(2) {
  position: relative;
}

.ranking-item:nth-child(3) {
  position: relative;
}

.history-btn-wrapper:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.history-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-label {
  color: white;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.history-sidebar {
  position: fixed;
  top: 0;
  right: -350px;
  width: 350px;
  max-width: 80vw;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
  z-index: 200;
  transition: right 0.3s ease;
  overflow-y: auto;

}

.history-sidebar:not(.hidden) {
  right: 0;

}

.history-header {
  position: sticky;
  top: 0;
  background: var(--primary);
  color: white;
  padding: var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;

}

.close-history {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;

}

.history-list {
  padding: var(--spacing-md);

}

.history-item {
  background: var(--card-bg);
  padding: var(--spacing-md);
  border-radius: 12px;
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;

}

.history-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-sm);

}

.history-item-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 14px;

}

.history-item-date {
  font-size: 11px;
  color: var(--text-light);

}

.history-item-info {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;

}

.history-item-winner {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;

}

.history-item-actions {
  margin-top: var(--spacing-sm);
  display: flex;
  gap: var(--spacing-sm);

}

.btn-delete-history {
  background: #ffebee;
  color: #c62828;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;

}

/* New History Card Styles */
.history-item-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 247, 244, 0.95) 100%);
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  border: 1px solid rgba(78, 205, 196, 0.2);
}

.history-item-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s;
}

.history-item-header:hover {
  background: rgba(78, 205, 196, 0.05);
}

.history-item-header .history-item-info {
  flex: 0 0 auto;
}

.history-item-header .history-item-type {
  font-weight: 700;
  font-size: 15px;
  color: #2C3E50;
  margin-bottom: 2px;
}

.history-item-header .history-item-time {
  font-size: 11px;
  color: #95A5A6;
}

.history-item-header .history-item-details {
  flex: 1;
  text-align: center;
}

.history-item-header .history-item-options {
  font-size: 13px;
  color: #7F8C8D;
  margin-bottom: 4px;
}

.history-item-header .history-item-winner {
  font-size: 16px;
  font-weight: 700;
  color: #4ECDC4;
}

.history-item-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-item-toggle {
  font-size: 12px;
  color: #4ECDC4;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(78, 205, 196, 0.1);
  transition: all 0.2s;
  cursor: pointer;
}

.history-item-toggle:hover {
  background: rgba(78, 205, 196, 0.2);
}

.toggle-icon {
  transition: transform 0.3s;
}

.history-delete-btn {
  background: transparent;
  border: none;
  color: #bdc3c7;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.6;
}

.history-delete-btn:hover {
  color: #e74c3c;
  opacity: 1;
  background: rgba(231, 76, 60, 0.1);
}

.history-item-table-container {
  padding: 0 12px 12px 12px;
  overflow-x: auto;
}

.history-item-table-container.hidden {
  display: none;
}

.history-score-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  min-width: 300px;
}

.history-score-table th {
  text-align: center;
  padding: 6px 8px;
  font-size: 11px;
  color: #7F8C8D;
  font-weight: 600;
  border-bottom: 1px solid #e0e0e0;
}

.history-score-table th:first-child {
  text-align: left;
}

.history-score-table tbody tr {
  background: #fafafa;
}

.history-score-table td {
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
}

.history-score-table td:first-child {
  text-align: left;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.history-score-table td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.importance-badge {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }

  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.history-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-light);

}

.history-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;

}

.history-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: all;

}


/* Intuition Option Cards */
.intuition-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0;
}

.intuition-option-card {
  padding: 24px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  text-align: center;
}

.intuition-option-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.intuition-option-card.selected {
  border-color: var(--primary);
  background: var(--surface-hover);
  transform: scale(1.02);
}

.intuition-option-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Analysis Section */
.analysis-section {
  margin-top: 24px;
  margin-bottom: 32px;
}

.analysis-card {
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.analysis-card.match {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  color: #2e7d32;
}

.analysis-card.conflict {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  color: #444444;
}

.analysis-card h3 {
  margin-top: 0;
  font-size: 20px;
  margin-bottom: 12px;
}

.analysis-card p {
  margin-bottom: 8px;
  line-height: 1.6;
}

.tag-intuition {
  display: inline-block;
  font-size: 12px;
  background: var(--text-secondary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}


/* --- Polished Styles (Step 1180+) --- */
/* Less Crowded Table */


/* Factor Name & Badge */
.factor-name-cell {
  min-width: 140px;
}

.factor-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;

}



/* Polished Remove Button (Option Input) */
.btn-remove-option {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e0e0e0;
  color: #999;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;

}

.btn-remove-option:hover {
  background: #ffebee;
  border-color: #ef9a9a;
  color: #c62828;
  transform: rotate(90deg);

}

/* General Button Polish */
.btn {
  border-radius: 12px;
  /* Softer radius */
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 12px 24px;

}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;

}

.scoring-table-container {
  margin: 20px 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scoring-table {
  border-spacing: 0 10px;
  border-collapse: separate;
  table-layout: fixed;
}


.scoring-table tbody tr {
  background: white;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Zebra Striping */
.scoring-table tbody tr:nth-child(even) {
  background-color: #eeeeee;
}

.scoring-table tbody tr:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
  background: #CCE2E0 !important;
  border-left: 4px solid var(--primary);
  position: relative;
  z-index: 10;
}


.scoring-table td {
  vertical-align: middle;
  text-align: center;
  padding: 12px 10px;
  height: 60px;
}

.scoring-table td:first-child {
  width: 30%;
  text-align: left;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  padding-left:25px;
  font-weight: 600;
  color: #2C3E50;
  font-size: 12px;
}

.scoring-table td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.scoring-table td select {
  display: block;
  margin: 0 auto;
}



.scoring-table th {
  padding: 12px 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  border-bottom: 2px solid var(--primary);
  white-space: nowrap;
}

.scoring-table th:first-child {
  text-align: middle;
  padding-left: 16px;
  min-width: 120px;
}


.score-select {
  width: 60%;
  height: 35px;
  min-width: 70px;
  padding: 0 40px 0 16px;
  font-size: 13px;
  font-weight: 700;
  color: #333333; /* 更深的文本颜色以确保可见性 */
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  appearance: none;
  padding-left: 12px;
  background-size: 14px;
  background-color: #f9f9f9;
  background-position: right 10px center;
  background-repeat: no-repeat;
  cursor: pointer;  /* Custom Arrow */
  background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23678872" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="6 9 12 15 18 9"%3E%3C/polyline%3E%3C/svg%3E');
}

.score-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(103, 136, 114, 0.2);
  background-color: white;
  outline: none;
}

.score-select:hover {
  border-color: #b0bec5;
  background-color: white;
}


/* Score Colors */
.score-select.score-high {
  color: #2e7d32;
  border-color: #a5d6a7;
  background-color: #f1f8e9;
}

.score-select.score-med {
  color: #ef6c00;
  border-color: #ffcc80;
  background-color: #fff3e0;
}

.score-select.score-low {
  color: #c62828;
  border-color: #ef9a9a;
  background-color: #ffebee;
}



/* Factor Name Styling */
.factor-name-cell {
  max-width: 150px;
  /* Prevent it from eating all space */
  white-space: normal;
  line-height: 1.4;
}

/* --- Flip Card Reveal Animation --- */
/* --- Flip Card Reveal Animation (Monument Style) --- */
.winner-reveal-section {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  perspective: 1200px;
  /* Deeper perspective */
}

.flip-card {
  background-color: transparent;
  width: 280px;
  height: 400px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  /* Elastic flip */
  transform-style: preserve-3d;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 4px solid rgba(255, 255, 255, 0.2);
}

/* Front Face (Mystery Gateway) */
.flip-card-front {
  background: linear-gradient(135deg, #2E2B5F 0%, #4ECDC4 100%);
  color: white;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.reveal-icon {
  font-size: 80px;
  margin-bottom: 24px;
  opacity: 1;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

.flip-card-front p {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Back Face (Treasure) */
.flip-card-back {
  background: white;
  color: var(--text-primary);
  transform: rotateY(180deg);
  border: 6px solid var(--accent);
  /* Thick golden frame */
  box-shadow: inset 0 0 20px rgba(255, 230, 109, 0.5);
}

.winner-badge {
  background: var(--accent);
  color: #B7950B;
  padding: 8px 20px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.winner-name {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--text-main);
  background: -webkit-linear-gradient(45deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.winner-score {
  font-size: 72px;
  font-weight: 900;
  color: var(--secondary);
  line-height: 1;
  margin-bottom: 12px;
  text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}

.winner-label {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

/* Result Cards (Non-winners) */
.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.result-rank {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #7F8C8D;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: #2C3E50;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-intuition {
  background: linear-gradient(135deg, #FFE66D 0%, #FFD93D 100%);
  color: #8B6914;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.score-bar-bg {
  height: 6px;
  background: #ecf0f1;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ECDC4 0%, #26a69a 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.result-score {
  flex-shrink: 0;
  font-size: 24px;
  font-weight: 800;
  color: #4ECDC4;
  min-width: 60px;
  text-align: right;
}



/* Utility Page (Overlay-like pages that don't participate in main step index) */
.utility-page {
  display: none;
  min-height: 100vh;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

.utility-page.active {
  display: block;
}


/* Enhanced Result Visibility */
.winner-name {
  font-size: 36px !important;
  color: var(--primary-dark) !important;
  margin-bottom: 8px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.winner-score {
  font-size: 80px !important;
  color: var(--primary) !important;
  text-shadow: 2px 4px 0px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px !important;
}

.result-card h3 {
  font-size: 20px !important;
  font-weight: 700 !important;
}

.result-score {
  font-size: 28px !important;
  font-weight: 800 !important;
  color: var(--primary);
}

.result-card.winner .result-score {
  color: #e65100;
  /* Deep Orange for top score in list */
  font-size: 32px !important;
}


/* Selectable Mode for Gap Analysis */
.selectable-mode tbody td {
  cursor: pointer;
}

.selectable-mode tbody td:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.selectable-cell {
  position: relative;
}

.uncertainty-check {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  opacity: 0;
  /* Invisible but clickable overlay */
  cursor: pointer;
  z-index: 2;
}

/* When selected as uncertain */
.selected-uncertain .score-display-read-only {
  background: repeating-linear-gradient(45deg,
      #fff,
      #fff 10px,
      #f0f4c3 10px,
      #f0f4c3 20px) !important;
  color: #827717 !important;
  border: 2px dashed #c0ca33;
}

.selected-uncertain::after {
  content: '❓';
  position: absolute;
  top: -10px;
  right: -10px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  z-index: 10;
}

/* Custom Confirm Modal */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.confirm-modal {
  background: white;
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.confirm-modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.confirm-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 12px;
}

.confirm-modal-message {
  font-size: 14px;
  color: #7F8C8D;
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-modal-actions .btn {
  flex: 1;
  padding: 12px 20px;
}

.confirm-modal-delete {
  background: #e74c3c;
  color: white;
  box-shadow: 0 4px 0 #c0392b;
}

.confirm-modal-delete:hover {
  background: #c0392b;
}

.confirm-modal-delete:active {
  box-shadow: none;
  transform: translateY(4px);
}

/* Save Modal (Gradient Style) */
.save-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3) 0%, rgba(255, 107, 107, 0.3) 100%);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.save-modal {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 25px 80px rgba(102, 126, 234, 0.5);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.save-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.save-modal-message {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  margin-bottom: 28px;
}

.save-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.save-modal-cancel {
  flex: 1;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.save-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

.save-modal-confirm {
  flex: 1;
  padding: 14px 20px;
  background: white;
  color: #667eea;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.save-modal-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.save-modal-confirm:active {
  transform: translateY(0);
}


.hidden {
  display: none !important;
}