/* 基础样式与配色 */
:root {
  /* Global Colors */
  --bg: #FAF6F0; /* Light warm beige */
  --text-main: #2A3D45; /* Dark charcoal */
  --text-sub: #5C6A70; /* Medium gray */
  --white: #FFFFFF;
  --border: transparent; /* Remove old border */
  --shadow-soft: 0 10px 25px -5px rgba(47, 58, 61, 0.08);
  --shadow-hover: 0 15px 35px -5px rgba(47, 58, 61, 0.15);

  /* Theme Colors */
  --theme-blue-bg: #DFEAF1;
  --theme-blue-icon: #2C7CB4;
  
  --theme-orange-bg: #fde8d0;
  --theme-orange-icon: #F5B34E;
  
  --theme-red-bg: #ffdfdf;
  --theme-red-icon: #E57373;

  --accent: #2D78A3; /* Use blue as primary accent */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft Yahei", sans-serif;
  color: var(--text-main);
  background: var(--bg);
  /* Flex Column Layout for Sticky Footer */
  display: flex;
  flex-direction: column;
}

.site-header {
  padding: 50px 24px 20px;
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 0; /* Ensure no extra margin from header */
}
.site-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.5px;
  color: var(--text-main);
}
.subtitle {
  margin: 8px 0 0;
  color: var(--text-sub);
  font-weight: 500;
}

.container { 
  max-width: 1024px; 
  margin: 0 auto; 
  padding: 0 20px 40px; 
  /* Fill remaining space */
  flex: 1;
  width: 100%;
}

/* Level 1 Selection Styles */
.level-selection {
  text-align: center;
}
.level-selection h2 {
  font-size: 20px;
  margin-bottom: 24px;
  color: var(--text-main);
  display: none; /* Hide standard H2 to cleaner look */
}

.category-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 12px; /* Small margin to match result section gap */
}

/* New Card Style */
.category-card {
  border-radius: 28px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  box-shadow: none; /* Removed shadow */
  position: relative;
  overflow: hidden;
  border: 4px solid transparent; /* For selection state */
}

/* Theme Variations - Normal State (Unselected) */
/* Normal: White bg, Icon box uses theme bg, Icon uses theme color */
.category-card {
  background-color: #fff; /* White background for all normal cards */
}

/* Theme Blue */
.theme-blue .icon-box { 
  background-color: var(--theme-blue-bg); 
  color: var(--theme-blue-icon);
}

/* Theme Orange */
.theme-orange .icon-box { 
  background-color: var(--theme-orange-bg);
  color: var(--theme-orange-icon);
}

/* Theme Red */
.theme-red .icon-box { 
  background-color: var(--theme-red-bg);
  color: var(--theme-red-icon);
}


/* Theme Variations - Selected/Active State (Hover or Selected) */
/* Selected: Card uses theme bg, Icon box uses theme icon color, Icon uses white */
.category-card:hover.theme-blue, 
.category-card.selected.theme-blue {
  background-color: var(--theme-blue-bg);
}
.category-card:hover.theme-blue .icon-box, 
.category-card.selected.theme-blue .icon-box {
  background-color: var(--theme-blue-icon);
  color: #fff;
}

.category-card:hover.theme-orange,
.category-card.selected.theme-orange {
  background-color: var(--theme-orange-bg);
}
.category-card:hover.theme-orange .icon-box,
.category-card.selected.theme-orange .icon-box {
  background-color: var(--theme-orange-icon);
  color: #fff;
}

.category-card:hover.theme-red,
.category-card.selected.theme-red {
  background-color: var(--theme-red-bg);
}
.category-card:hover.theme-red .icon-box,
.category-card.selected.theme-red .icon-box {
  background-color: var(--theme-red-icon);
  color: #fff;
}

/* Card Body (Icon + Text) */
.card-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
  flex: 1;
  /* Add min-width to prevent squishing */
  min-width: 0; 
}

.text-content {
  text-align: left;
  /* Ensure text truncates if needed, giving more priority to controls */
  flex-shrink: 1; 
  white-space: nowrap;
}

/* Meta Bar (White Capsule) - Now positioned on the right */
.meta-bar {
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0; /* Don't let controls shrink */
  margin-left: 12px; /* Add explicit gap between text and controls */
}

/* Re-adding accidentally removed styles */
.icon-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  /* Colors are now handled by theme selectors above */
}

.category-card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.subtitle-text {
  margin: 0;
  font-size: 14px;
  font-weight: 300;
  color: var(--text-sub);
}

/* Hover & Selected States */
.category-card:hover {
  transform: translateY(-4px);
  /* box-shadow: var(--shadow-hover);  Removed per user request */
}

.category-card.selected {
  /* border-color: rgba(45, 120, 163, 0.5); Removed per user request */
  transform: translateY(-4px);
}

/* Mini Segmented Control (Adapted for White Bar) */
.mini-segmented-control {
  display: flex;
  background: rgba(255, 255, 255, 0.5); /* Semi-transparent white */
  border-radius: 16px;
  padding: 4px;
  gap: 2px; /* Reduce gap slightly */
}

.mini-segment-btn {
  flex: 0 0 auto; /* Don't stretch */
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding: 6px 12px; /* Reduce padding slightly */
  font-size: 13px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-segment-btn:hover {
  background: rgba(255,255,255,0.8);
}

/* Theme-specific active states for segmented control */
.theme-blue .mini-segment-btn.active {
  background: var(--theme-blue-icon); /* Changed to blue bg */
  color: #fff; /* Changed to white text */
  box-shadow: 0 2px 8px rgba(45, 120, 163, 0.15);
}

/* Meta Tags for other cards */
.meta-tag {
  display: none; /* Hide old meta tags */
}

/* Primary Button */
.primary-btn {
  margin-top: 32px;
  padding: 16px 40px;
  background: #382F2C; /* Dark brown/black as requested */
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none; /* Removed shadow */
  transition: all 0.2s ease;
  width: 100%;
  max-width: 300px;
  display: block; /* Added block display */
  margin-left: auto; /* Center horizontally */
  margin-right: auto; /* Center horizontally */
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: none; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled {
  background: #C4C8CC;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Result Section Styles */
.result {
  margin-top: 12px; /* Reduced from 24px to match category-grid margin */
  background: #fff; /* Default fallback */
  border-radius: 32px;
  padding: 32px;
  box-shadow: none; /* Removed shadow */
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
/* Theme styles for result card - Background Colors */
.result.theme-blue { background-color: var(--theme-blue-bg); }
.result.theme-orange { background-color: var(--theme-orange-bg); }
.result.theme-red { background-color: var(--theme-red-bg); }

/* Dynamic Button Colors based on theme - ensure high specificity */
.result.theme-blue button#drawBtn { background-color: var(--theme-blue-icon); }
.result.theme-orange button#drawBtn { background-color: var(--theme-orange-icon); }
.result.theme-red button#drawBtn { background-color: var(--theme-red-icon); }

.result-header {  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.result-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text-main);
  text-align: center;
}

.icon-btn {
  background: rgba(255,255,255,0.5); /* Semi-transparent white */
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  width: auto;
}

.icon-btn:hover {
  background: #fff;
  color: var(--text-main);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.result-item { 
  background: #fff; /* White background for items */
  border-radius: 20px; 
  padding: 16px 20px; 
  border: none;
  min-height: auto;
  display: flex;
  flex-direction: column;
}

.label { color: var(--text-sub); font-size: 13px; font-weight: 600; margin-bottom: 4px;}
.value { 
  font-size: 18px; 
  font-weight: 700; 
  color: var(--text-main); 
  letter-spacing: 0.2px; 
  line-height: 1.4;
}

.hint { margin: 20px 0 0; color: var(--text-sub); font-size: 13px; text-align: center; opacity: 0.7; }

  /* 响应式 */
  @media (max-width: 600px) {
    .category-grid { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: 1fr; }
    .container { padding: 0 16px 40px; }
    .site-header { padding-top: 30px; }
    
    /* Optimize card layout for small screens */
    .category-card { padding: 16px; }
    .icon-box { width: 48px; height: 48px; font-size: 24px; }
    .category-card h3 { font-size: 18px; }
    .meta-bar { margin-left: 8px; }
    /* Slightly increased padding for better touch target */
    .mini-segment-btn { padding: 6px 14px; font-size: 13px; }
  }
  
  .site-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-sub);
    opacity: 0.6;
    flex-shrink: 0; /* Prevent shrinking in flex layout */
  }
