﻿
    /* ===== CSS Variables ===== */
    :root {
      /* Color System */
      --bg-deep: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
      --bg-card: #ffffff;
      --bg-glass: rgba(255, 255, 255, 0.08);
      --bg-highlight: #fef5e7;
      
      --text-display: #ffffff;
      --text-body: #2d3748;
      --text-muted: #4a5568;
      --text-accent: #1e3c72;
      
      --accent: #ffd700;
      --accent-secondary: #2d3748;
      --accent-guide: #38a169;
      --accent-related: #3182ce;
      --error-color: #ff6b6b;
      --success-color: #4caf50;
      
      --radius: 16px;
      --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
      --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      --transition-fast: all 0.15s ease;
      
      /* Layout Constants */
      --header-height: 80px;
      --trigram-size: 88px;
      --compass-margin: 20px;
      --scroll-offset: 120px;
    }
    
    .bagua-tool * { margin: 0; padding: 0; box-sizing: border-box; }
    
    html {
      scroll-behavior: smooth;
      scroll-padding-top: var(--header-height);
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
      background: var(--bg-deep);
      min-height: 100vh;
      color: var(--text-display);
      line-height: 1.6;
      display: flex;
      flex-direction: column;
    }
    
    /* Skip Link */
    .skip-link {
      position: absolute;
      top: -40px; left: 6px;
      background: var(--accent); color: var(--text-body);
      padding: 8px; border-radius: 4px;
      text-decoration: none; z-index: 1000;
      transition: top 0.3s;
    }
    .skip-link:focus { 
      top: 6px;
      outline: 3px solid #000;
      outline-offset: 2px;
    }
    
    /* ===== App Header ===== */
    .app-header {
      flex-shrink: 0;
      padding: 20px;
      background: rgba(0, 0, 0, 0.15);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    }
    
    .brand-identity {
      text-align: center;
      max-width: 800px;
      margin: 0 auto;
    }
    
    .brand-identity h1 {
      font-size: clamp(1.8rem, 4vw, 2.5rem);
      color: var(--text-display);
      margin: 0 0 8px 0;
      font-weight: 700;
      text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .tagline {
      font-size: clamp(0.9rem, 2vw, 1.1rem);
      color: var(--text-muted);
      margin: 0;
    }
    
    .tagline .lang-cn {
      color: var(--accent);
      font-weight: 500; font-size: 0.9em;
    }
    
    .tagline .brand-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--accent);
      text-decoration: none;
      font-weight: 600;
      border-bottom: 1px dotted var(--accent);
      transition: var(--transition);
      margin-left: 8px;
      white-space: nowrap;
    }
    
    .tagline .brand-link:hover {
      border-bottom-style: solid;
      transform: translateY(-1px);
    }
    
    .tagline .brand-link::after {
      content: "↗";
      font-size: 0.8em;
      opacity: 0.8;
    }
    
    /* ===== Main Container ===== */
    .container {
      flex: 1;
      width: 100%;
      max-width: 1400px;
      margin: 0 auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
    }
    
    /* ===== Tool Section ===== */
    .tool-section {
      flex: none;
      padding: 30px 20px;
      text-align: center;
    }
    
    /* Mode Switcher */
    .mode-switcher {
      display: flex;
      justify-content: center;
      gap: 30px;
      margin: 30px 0;
      padding: 0 20px;
    }
    
    .mode-option {
      position: relative;
    }
    
    .mode-option input[type="radio"] {
      position: absolute;
      opacity: 0;
      width: 0; height: 0;
    }
    
    .mode-btn {
      display: flex;
      align-items: center;
      gap: 15px;
      padding: 18px 30px;
      background: var(--bg-glass);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: var(--radius);
      cursor: pointer;
      transition: var(--transition);
      backdrop-filter: blur(10px);
      min-width: 220px;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .mode-btn:hover {
      background: rgba(255, 255, 255, 0.15);
      transform: translateY(-3px);
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }
    
    .mode-option input:checked + .mode-btn {
      background: rgba(255, 215, 0, 0.25);
      border-color: var(--accent);
      box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
    }
    
    .mode-option input:focus + .mode-btn {
      outline: 3px solid var(--accent);
      outline-offset: 2px;
    }
    
    /* ===== Compass Container ===== */
    .compass-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin: 40px 0;
      min-height: 400px;
      position: relative;
    }
    
    .compass-outer-ring {
      position: absolute;
      width: 500px; height: 500px;
      pointer-events: none;
    }
    
    .direction-label {
      position: absolute;
      font-weight: bold; font-size: 14px;
      text-align: center; line-height: 1.2;
      color: var(--text-display);
      text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    }
    .north { top: 10px; left: 50%; transform: translateX(-50%); }
    .northeast { top: 35px; right: 35px; }
    .east { top: 50%; right: 10px; transform: translateY(-50%); }
    .southeast { bottom: 35px; right: 35px; }
    .south { bottom: 10px; left: 50%; transform: translateX(-50%); }
    .southwest { bottom: 35px; left: 35px; }
    .west { top: 50%; left: 10px; transform: translateY(-50%); }
    .northwest { top: 35px; left: 35px; }
    
    .bagua-compass {
      width: 400px; height: 400px;
      border-radius: 50%;
      position: relative;
      background: radial-gradient(circle, var(--bg-glass) 0%, rgba(255, 255, 255, 0.05) 100%);
      border: 3px solid rgba(255, 255, 255, 0.3);
      backdrop-filter: blur(10px);
      transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: var(--shadow);
      will-change: transform;
      transform: translateZ(0);
      cursor: grab;
    }
    
    .bagua-compass:active { cursor: grabbing; }
    
    /* Taiji Center */
    .taiji-center {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      z-index: 10;
    }
    
    #taijiSymbol {
      animation: rotate 15s linear infinite, breathe 4s ease-in-out infinite;
      transform-origin: 40px 40px;
    }
    
    @keyframes rotate {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }
    
    @keyframes breathe {
      0%, 100% { filter: brightness(1); }
      50% { filter: brightness(1.2); }
    }
    
    @keyframes highlightSection {
      0% { background-color: transparent; }
      50% { background-color: var(--bg-highlight); }
      100% { background-color: transparent; }
    }
    
    @keyframes slideIn {
      from { transform: translateX(100%); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }
    
    @keyframes slideOut {
      from { transform: translateX(0); opacity: 1; }
      to { transform: translateX(100%); opacity: 0; }
    }
    
    /* Trigram Positions */
    .trigram-position {
      position: absolute;
      width: var(--trigram-size); 
      height: var(--trigram-size);
      cursor: pointer;
      transition: var(--transition);
      text-align: center;
      z-index: 5;
      border: none; background: none;
      color: inherit; padding: 10px;
    }
    
    .trigram-position:hover, .trigram-position:focus {
      transform: scale(1.2);
      filter: drop-shadow(0 0 10px var(--accent));
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }
    
    .trigram {
      font-family: 'Segoe UI Symbol', 'Apple Symbols', sans-serif;
      font-size: 2.5rem; font-weight: 700;
      line-height: 1;
      margin-bottom: 5px;
      text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    }
    
    .trigram-name {
      font-size: 0.8rem; opacity: 0.8;
    }
    
    /* Trigram positions using CSS variables */
    [data-position="0"] { top: 20px; left: 50%; transform: translateX(-50%); }
    [data-position="1"] { top: 45px; right: 45px; }
    [data-position="2"] { top: 50%; right: 20px; transform: translateY(-50%); }
    [data-position="3"] { bottom: 45px; right: 45px; }
    [data-position="4"] { bottom: 20px; left: 50%; transform: translateX(-50%); }
    [data-position="5"] { bottom: 45px; left: 45px; }
    [data-position="6"] { top: 50%; left: 20px; transform: translateY(-50%); }
    [data-position="7"] { top: 45px; left: 45px; }
    
    /* Control Buttons */
    .control-cluster {
      margin: 25px 0;
      display: flex;
      justify-content: center;
    }
    
    .control-group {
      display: flex;
      gap: 15px;
      background: var(--bg-glass);
      padding: 12px;
      border-radius: 20px;
      backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .control-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 14px 20px;
      background: rgba(255, 255, 255, 0.08);
      border: none; border-radius: 12px;
      cursor: pointer;
      transition: var(--transition);
      color: var(--text-display);
      min-width: 90px;
    }
    
    .control-btn:hover { background: rgba(255, 215, 0, 0.3); transform: translateY(-2px); }
    .btn-icon { font-size: 1.8rem; }
    .btn-label { font-size: 0.75rem; opacity: 0.9; }
    
    /* Dual CTA Block */
    .dual-cta-block {
      display: flex;
      gap: 20px;
      justify-content: center;
      flex-wrap: wrap;
      margin: 30px 0;
      padding: 0 20px;
      max-width: 800px;
      width: 100%;
    }
    
    .cta-guide, .cta-related {
      display: flex;
      align-items: center;
      gap: 15px;
      flex: 1;
      min-width: 280px;
      max-width: 400px;
      padding: 18px 24px;
      border: none; border-radius: var(--radius);
      cursor: pointer;
      transition: var(--transition);
      text-align: left;
      color: white;
      text-decoration: none;
    }
    
    .cta-guide {
      background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
      box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
    }
    .cta-guide:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 25px rgba(56, 161, 105, 0.4);
    }
    
    .cta-related {
      background: linear-gradient(135deg, #3182ce 0%, #4299e1 100%);
      box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
    }
    .cta-related:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 25px rgba(49, 130, 206, 0.4);
    }
    
    .cta-icon { font-size: 2rem; flex-shrink: 0; }
    .cta-text { line-height: 1.4; }
    .cta-text strong { font-size: 1.1rem; display: block; }
    .cta-text small { opacity: 0.9; font-size: 0.85rem; }
    
    /* Details Panel */
    .details-panel {
      position: fixed;
      right: -400px; top: 50%;
      transform: translateY(-50%);
      width: 350px; max-height: 80vh;
  background: #f0f2f5 !important;  /* 带有蓝色调的浅灰 */
  color: #2d3748 !important;
      border-radius: 16px;
      padding: 20px;
      transition: right 0.5s;
      backdrop-filter: blur(20px);
      border: 1px solid rgba(255, 255, 255, 0.2);
      z-index: 100;
      overflow-y: auto;
    }
    
    .details-panel.active { right: 20px; }
    
    .panel-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .close-btn {
  color: #4a5568 !important;  /* 深灰色 */
  font-size: 2rem !important;
  font-weight: 300 !important;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
    }
    
    .close-btn:hover, .close-btn:focus {
  color: #1a202c !important;  /* 更深的黑色 */
  background-color: rgba(0, 0, 0, 0.05);
  outline: 2px solid #1e3c72;
  outline-offset: 2px;
  transform: scale(1.1);
    }
    
    /* ===== Content Area ===== */
    .content-wrapper {
      display: flex;
      gap: 30px;
      align-items: flex-start;
    }
    
    .seo-content {
      flex: 1;
      background: var(--bg-card);
      color: var(--text-body);
      border-radius: 20px;
      padding: 40px;
      box-shadow: var(--shadow);
      font-size: 17px;
      line-height: 1.8;
    }
    
    .seo-content header { text-align: center; margin-bottom: 40px; }
    
    .seo-content h2 {
      color: var(--text-accent);
      font-size: 2.2rem;
      margin: 50px 0 25px;
      font-weight: 700;
    }
    
    .seo-content h3 {
      color: var(--text-accent);
      font-size: 1.6rem;
      margin: 35px 0 18px;
      font-weight: 600;
    }
    
    .seo-content p { margin-bottom: 20px; }
    
    .seo-content ul {
      margin: 20px 0 20px 30px;
    }
    
    .seo-content li {
      margin-bottom: 12px;
      padding-left: 10px;
      position: relative;
    }
    
    .seo-content li::before {
      content: "•";
      color: var(--accent);
      font-weight: bold;
      position: absolute;
      left: -20px;
    }
    
    .highlight {
      background: var(--bg-highlight);
      color: var(--text-accent);
      font-weight: 600;
      padding: 0.1em 0.3em;
      border-radius: 3px;
    }
    
    /* ===== TOC Styles ===== */
    .smart-toc {
      width: 280px;
      background: var(--bg-glass);
      border-radius: var(--radius);
      padding: 20px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      transition: transform 0.3s ease;
    }
    
    .toc-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 20px;
      padding-bottom: 15px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .toc-icon { font-size: 1.5rem; }
    .toc-header h2 { font-size: 1.2rem; margin: 0; }
    .toc-close { display: none; }
    
    .toc-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    
    .toc-link {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 0;
      color: var(--text-display);
      text-decoration: none;
      transition: var(--transition-fast);
      border-left: 3px solid transparent;
      padding-left: 10px;
      background: transparent;
    }
    
    .toc-link:hover {
      background: rgba(255, 215, 0, 0.1);
    }
    
    .toc-link.active {
      border-left-color: var(--accent);
      background: rgba(255, 215, 0, 0.15);
      font-weight: 600;
    }
    
    .toc-marker {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: var(--accent);
      opacity: 0;
      transition: opacity 0.3s;
    }
    
    .toc-link.active .toc-marker { opacity: 1; }
    
    .toc-progress {
      margin-top: 20px;
      height: 2px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 1px;
      overflow: hidden;
    }
    
    .toc-progress-bar {
      height: 100%;
      background: var(--accent);
      width: 0%;
      transition: width 0.3s;
    }
    
    /* Mobile TOC Overlay - Fixed as separate element */
    .toc-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s, visibility 0.3s;
      z-index: 999;
      cursor: pointer;
    }
    
    .toc-overlay.active {
      opacity: 1;
      visibility: visible;
    }
    
    /* Mobile TOC Trigger Button */
    .toc-trigger {
      display: none;
      position: fixed;
      bottom: 20px; right: 20px;
      z-index: 99;
      background: var(--accent);
      color: var(--text-body);
      border: none;
      border-radius: 50%;
      width: 56px; height: 56px;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 15px rgba(0,0,0,0.3);
      cursor: pointer;
      transition: var(--transition);
    }
    
    .toc-trigger:hover {
      transform: scale(1.1);
    }
    
    /* Notification System */
    .notification {
      position: fixed;
      top: 20px;
      right: 20px;
      padding: 15px 20px;
      border-radius: 8px;
      color: white;
      z-index: 10000;
      box-shadow: 0 4px 15px rgba(0,0,0,0.3);
      animation: slideIn 0.3s ease;
      max-width: 300px;
    }
    
    .notification-error {
      background: var(--error-color);
    }
    
    .notification-success {
      background: var(--success-color);
    }
    
    .notification-info {
      background: var(--accent-related);
    }
    
    /* Error State */
    .error-state {
      padding: 40px;
      background: rgba(255, 0, 0, 0.1);
      border: 2px solid var(--error-color);
      border-radius: var(--radius);
      text-align: center;
      color: var(--text-display);
    }
    
    .error-state h3 {
      margin-bottom: 15px;
      font-size: 1.5rem;
    }
    
    .error-state button {
      margin-top: 20px;
      padding: 10px 20px;
      background: var(--error-color);
      color: white;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-size: 1rem;
      transition: var(--transition);
    }
    
    .error-state button:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
    }
    
    /* FAQ */
    .faq-section {
      margin-top: 60px;
      padding-top: 50px;
      border-top: 2px solid rgba(0, 0, 0, 0.1);
    }
    
    .faq-section dt {
      font-size: 1.1rem;
      margin: 25px 0 8px;
      padding: 10px 0;
      cursor: pointer;
      border-bottom: 1px dashed #e2e8f0;
    }
    
    .faq-section dd {
      margin: 0 0 15px 20px;
      padding: 15px 0;
      font-size: 0.95rem;
      color: var(--text-muted);
    }
    
    /* ===== Footer ===== */
    .bagua-tool footer {
      flex-shrink: 0;
      text-align: center;
      padding: 40px 20px 20px;
      color: rgba(255, 255, 255, 0.7);
      background: rgba(0, 0, 0, 0.2);
    }
    
    .bagua-tool .footer-content {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 20px;
      margin-bottom: 15px;
      max-width: 1200px;
      margin: 0 auto 20px;
    }
    
    .bagua-tool .footer-brand a {
      color: var(--accent);
      text-decoration: none;
      font-size: 1.1rem;
      font-weight: 600;
    }
    
    .bagua-tool .footer-brand p {
      margin: 5px 0 0;
      font-size: 0.85rem;
      opacity: 0.8;
    }
    
    .bagua-tool .footer-nav {
      display: flex;
      gap: 20px;
      flex-wrap: wrap;
    }
    
    .bagua-tool .footer-nav a {
      color: inherit;
      text-decoration: none;
      padding: 5px 0;
      border-bottom: 1px dotted transparent;
      transition: border-color 0.3s;
    }
    
    .bagua-tool .footer-nav a:hover {
      border-bottom-color: var(--accent);
    }
    
    /* ===== Responsive Design ===== */
    
    /* Desktop: Two Column Layout */
    @media (min-width: 769px) {
      .content-wrapper {
        display: flex;
        gap: 30px;
        align-items: flex-start;
      }
      
      .smart-toc {
        position: sticky;
        top: 20px;
        flex-shrink: 0;
        width: 280px;
      }
      
      .seo-content {
        flex: 1;
        margin-bottom: 0;
      }
    }
    
    /* Mobile Optimization */
    @media (max-width: 768px) {
      html { scroll-padding-top: 60px; }
      
      .app-header { padding: 15px 10px 5px 10px; }
      .brand-identity h1 { font-size: clamp(1.5rem, 5vw, 1.8rem); margin-bottom: 5px; }
      .tagline { font-size: 0.85rem; }
      
      .container { padding: 0; }
      
      .tool-section { padding: 20px 15px; }
      
      .mode-switcher {
      flex-direction: row; /* 保持横向 */
        gap: 15px;
      margin: 10px 0 15px 0; /* ⚠️ 底部增加到 25px，防止罗盘撞上来 */
      }
      
      .mode-btn { min-width: 280px; }
      
      .compass-container {
        min-height: auto;
        margin: 20px 0;
      }
      
      .compass-outer-ring {
        width: 90vw; height: 90vw;
        max-width: 360px; max-height: 360px;
      }
      
      .bagua-compass {
        width: min(80vw, 320px);
        height: min(80vw, 320px);
      }
      
      .trigram-position {
        width: var(--trigram-size); 
        height: var(--trigram-size);
      }
      
      .trigram { font-size: 1.8rem; }
      .btn-label { font-size: 0.65rem; }
      
      .dual-cta-block {
        flex-direction: column;
       padding: 0 5px;
       margin: 5px 0 20px 0; 
      }
      
      .cta-guide, .cta-related {
        min-width: 100%;
        padding: 12px 15px; /* 保持内部舒适度 */
      }
      
      .seo-content { padding: 20px; }
      .seo-content h2 { font-size: 1.7rem; }
      .seo-content h3 { font-size: 1.4rem; }
      
      /* Mobile TOC Drawer */
      .smart-toc {
        position: fixed;
        inset: 0 0 0 auto;
        width: 100%;
        max-width: 320px;
        transform: translateX(100%);
        margin: 0;
        border-radius: 0;
        border: none;
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
      }
      
      .smart-toc.mobile-active {
        transform: translateX(0);
      }
      
      .toc-close {
        display: block;
        background: none; border: none;
        width: 32px; height: 32px;
        cursor: pointer;
        position: relative;
        margin-left: auto;
      }
      
      .toc-close-icon::before,
      .toc-close-icon::after {
        content: '';
        position: absolute;
        top: 50%; left: 50%;
        width: 20px; height: 2px;
        background: var(--text-display);
        transform: translate(-50%, -50%) rotate(45deg);
      }
      
      .toc-close-icon::after {
        transform: translate(-50%, -50%) rotate(-45deg);
      }
      
      .toc-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
      }
      
      .bagua-tool .footer-content {
        flex-direction: column;
        text-align: center;
      }
      
      .bagua-tool .footer-nav {
        justify-content: center;
      }
    }
    
    /* Reduced Motion */
    @media (prefers-reduced-motion: reduce) {
      .bagua-tool * { 
        animation-duration: 0.01ms;
        transition-duration: 0.01ms;
      }
      #taijiSymbol { animation: none; }
    }
    
    /* High Contrast */
    @media (prefers-contrast: high) {
      :root {
        --text-body: #000;
        --accent: #ff0;
        --bg-glass: rgba(0,0,0,0.9);
      }
    }
    
    /* Print */
    @media print {
      body { background: none; color: #000; }
      .tool-section { display: none; }
      .smart-toc, .toc-trigger, .details-panel { display: none; }
      .dual-cta-block { display: none; }
    }
/* ===== 新增CSS样式 ===== */

/* 卦象卡片样式 */
.trigram-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.trigram-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.trigram-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--trigram-color), transparent);
}

.trigram-card.metal { --trigram-color: #7f8c8d; }
.trigram-card.earth { --trigram-color: #d35400; }
.trigram-card.water { --trigram-color: #3498db; }
.trigram-card.fire { --trigram-color: #e74c3c; }
.trigram-card.wood { --trigram-color: #27ae60; }

.trigram-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.trigram-symbol-large {
  font-size: 3.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  min-width: 70px;
}

.trigram-title h3 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--text-accent);
}

.trigram-title p {
  margin: 5px 0 0;
  opacity: 0.7;
  font-size: 0.9em;
}

.trigram-attributes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.attribute-item {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
}

.attribute-label {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 4px;
}

.attribute-value {
  font-weight: 600;
  font-size: 1rem;
}

/* 方向高亮动画 */
@keyframes pulse-direction {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.trigram-position.highlighted {
  animation: pulse-direction 1.5s ease infinite;
  z-index: 20;
}

/* 语义关键词标签 */
.semantic-tag {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin: 3px;
  white-space: nowrap;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .trigram-grid {
    grid-template-columns: 1fr;
  }
  
  .trigram-attributes {
    grid-template-columns: 1fr;
  }
  
  .systems-comparison-container {
    grid-template-columns: 1fr;
  }
  
  .applications-grid {
    grid-template-columns: 1fr;
  }
}

/* 打印优化 */
@media print {
  .trigram-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
/* 在现有的动态样式中添加以下修复 */

/* 修复方向信息文本颜色 */
.direction-info {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid #4299e1;
  color: #4a5568; /* 确保所有文本有颜色 */
}

.direction-current, .direction-opposite {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  font-size: 1rem;
  color: #2d3748; /* 深灰色确保可读性 */
}

.direction-current strong,
.direction-opposite strong {
  color: #4a5568; /* 中灰色标签 */
  font-weight: 600;
}

/* 确保所有文本都有正确的颜色 */
.enhanced-trigram-view,
.expanded-trigram-view {
  color: #2d3748 !important; /* 强制深灰色文本 */
}

/* 修复可能被继承的白色文本 */
.panel-content,
#panelContent,
.details-panel,
.enhanced-trigram-view *,
.expanded-trigram-view * {
  color: inherit !important;
}

/* 确保特定文本元素有颜色 */
.attribute-label,
.attribute-value,
.expanded-label,
.expanded-value,
.modern-application p,
.archetype-section p,
.affirmation {
  color: inherit !important;
}

/* 修复白色文本问题的根源 */
#detailsPanel .panel-content {
  color: #2d3748 !important;
}

/* 如果背景是深色，确保文本是浅色 */
@media (prefers-color-scheme: dark) {
  .details-panel {
    background: rgba(30, 30, 40, 0.95) !important;
    color: #e2e8f0 !important;
  }
  
  .details-panel * {
    color: #e2e8f0 !important;
  }
  
  .direction-info {
    background: rgba(255, 255, 255, 0.1) !important;
    border-left-color: #63b3ed !important;
  }
  
  .direction-value {
    color: #90cdf4 !important;
    background: rgba(66, 153, 225, 0.2) !important;
  }
/* 在现有的动态样式中添加或更新以下颜色规则 */

/* 增强详情面板颜色方案 */
.enhanced-trigram-view {
  padding: 10px;
  color: #2d3748; /* 主要文本颜色 - 深灰 */
}

/* 方向信息颜色 */
.direction-info {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid #4299e1; /* 蓝色边框表示方向 */
}

.direction-current, .direction-opposite {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  font-size: 1rem;
}

.direction-current strong,
.direction-opposite strong {
  color: #4a5568; /* 中灰色标签 */
  font-weight: 600;
}

.direction-value {
  font-weight: bold;
  color: #2b6cb0; /* 深蓝色突出方向值 */
  background: #ebf8ff;
  padding: 2px 8px;
  border-radius: 4px;
}

/* 属性网格颜色 */
.attributes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.attribute {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.attribute:hover {
  border-color: #4299e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(66, 153, 225, 0.15);
}

.attribute-label {
  font-size: 0.85rem;
  color: #718096; /* 浅灰色标签 */
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.attribute-value {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2d3748; /* 深灰色值 */
}

/* 特定属性的特殊颜色 */
.attribute:nth-child(1) .attribute-value { color: #2b6cb0; } /* 季节 - 蓝色 */
.attribute:nth-child(2) .attribute-value { 
  color: #9c4221; /* 数字 - 棕色 */
  font-size: 1.3rem;
}
.attribute:nth-child(3) .attribute-value { 
  color: #276749; /* 身体器官 - 绿色 */
  font-weight: 600;
}
.attribute:nth-child(4) .attribute-value { 
  color: #b7791f; /* 颜色 - 金色 */
  font-weight: 600;
}

/* 现代应用部分颜色 */
.modern-application {
  margin: 20px 0;
  padding: 18px;
  background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
  border-radius: 10px;
  border: 1px solid #c6f6d5;
}

.modern-application h4 {
  margin-top: 0;
  color: #276749; /* 绿色标题 */
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modern-application h4::before {
  content: "🎯";
  font-size: 1.3rem;
}

.modern-application p {
  color: #2d3748;
  margin: 10px 0 0;
  line-height: 1.6;
  font-size: 1rem;
}

/* 原型部分颜色 */
.archetype-section {
  margin: 20px 0;
  padding: 18px;
  background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
  border-radius: 10px;
  border: 1px solid #fed7d7;
}

.archetype-section h4 {
  margin-top: 0;
  color: #9b2c2c; /* 红色标题 */
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.archetype-section h4::before {
  content: "🧬";
  font-size: 1.3rem;
}

.archetype-section p {
  margin: 8px 0;
}

.archetype-section p strong {
  color: #744210; /* 深棕色强调原型名称 */
  font-size: 1.1rem;
}

.affirmation {
  font-style: italic;
  color: #718096; /* 中灰色 */
  margin-top: 12px !important;
  padding: 12px;
  background: white;
  border-radius: 8px;
  border-left: 4px solid #d69e2e; /* 金色边框 */
  font-size: 1.05rem;
  line-height: 1.5;
}

/* 语义标签颜色优化 */
.semantic-tags {
  margin: 15px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.semantic-tag {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.semantic-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 五行徽章颜色优化 */
.element-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.element-badge.metal { 
  background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
  border: 1px solid #95a5a6;
}

.element-badge.earth { 
  background: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
  border: 1px solid #e67e22;
}

.element-badge.water { 
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border: 1px solid #2980b9;
}

.element-badge.fire { 
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border: 1px solid #c0392b;
}

.element-badge.wood { 
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  border: 1px solid #229954;
}

/* 标题颜色优化 */
.trigram-header-enhanced h2 {
  margin: 0;
  font-size: 1.9rem;
  color: #1a202c; /* 接近黑色 */
  font-weight: 800;
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trigram-header-enhanced h3 {
  margin: 5px 0;
  color: #4a5568; /* 中灰色 */
  font-size: 1.3rem;
  font-weight: 600;
}

/* 扩展视图的颜色优化 */
.expanded-grid .expanded-item {
  padding: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.expanded-grid .expanded-item:hover {
  border-color: #4299e1;
  box-shadow: 0 4px 6px rgba(66, 153, 225, 0.1);
}

.expanded-label {
  font-size: 0.85rem;
  color: #718096; /* 浅灰色标签 */
  margin-bottom: 4px;
  font-weight: 500;
}

.expanded-value {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2d3748; /* 深灰色值 */
}

/* 移动端优化 */
@media (max-width: 768px) {
  .direction-current, 
  .direction-opposite {
    flex-direction: column;
    gap: 4px;
  }
  
  .direction-value {
    align-self: flex-start;
  }
  
  .attributes-grid {
    grid-template-columns: 1fr;
  }
  
  .modern-application,
  .archetype-section {
    padding: 15px;
  }

}
  