/* HanziLab - Complete Unified Stylesheet */
/* fonts loaded via HTML */
500;600;700;800&family=Noto+Sans+SC:wght@400;600;700&display=swap');

:root {
  --primary: #C43E2B; --primary-dark: #A83222; --primary-light: #FDF2F0;
  --secondary: #2D3748; --accent-gold: #D4A843; --accent-jade: #4A7C59; --accent-teal: #319795;
  --bg-warm: #FFFAF5; --bg-white: #FFFFFF; --text-dark: #1A202C; --text-mid: #4A5568; --text-light: #A0AEC0;
  --border: #E2E8F0; --shadow: 0 4px 24px rgba(0,0,0,0.08); --radius: 16px; --radius-sm: 10px;
}
html { scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; color: var(--text-dark); background: var(--bg-warm); margin: 0; line-height: 1.5; }

/* === NAVIGATION === */
.navbar { background: rgba(255,255,255,0.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 68px; position: relative; }
.nav-logo { font-size: 1.4rem; font-weight: 800; color: var(--primary); text-decoration: none; }
.nav-logo span { color: var(--text-dark); }
.nav-links { display: flex; gap: 28px; align-items: center; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-links a { text-decoration: none; color: var(--text-mid); font-size: 0.9rem; font-weight: 500; transition: color 0.2s; white-space: nowrap; }
.nav-links a:hover { color: var(--primary); }
.nav-btn { background: var(--primary); color: #fff !important; padding: 10px 22px; border-radius: 8px; font-weight: 600 !important; font-size: 0.85rem !important; transition: background 0.2s; }
.nav-btn:hover { background: var(--primary-dark) !important; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-dark); padding: 4px; }
@media (max-width: 768px) {
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 16px 24px; box-shadow: var(--shadow); gap: 16px; transform: none; }
  .nav-links.open { display: flex; }
  .mobile-menu-btn { display: block; }
}

/* === CONTAINER === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* === HERO === */
.hero { padding: 60px 0 40px; text-align: center; }
.page-hero { padding: 48px 0 24px; text-align: center; background: var(--bg-white); border-bottom: 1px solid var(--border); }
.page-hero h1 { font-size: 2rem; font-weight: 800; margin: 0 0 8px; }
.page-hero p { color: var(--text-mid); max-width: 600px; margin: 0 auto; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 3rem); font-weight: 800; line-height: 1.2; margin: 0 0 12px; }
.hero p { font-size: 1.1rem; color: var(--text-mid); max-width: 600px; margin: 0 auto 28px; line-height: 1.6; }
.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 800px; margin: 0 auto; }
@media (max-width: 640px) { .hero-cards { grid-template-columns: 1fr; } }
.hero-card { background: var(--bg-white); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden; }
.hero-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary); }
.hero-card:last-child::before { background: var(--accent-jade); }
.hero-card .icon { font-size: 2.2rem; margin-bottom: 12px; }
.hero-card h3 { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; }
.hero-card p { font-size: 0.9rem; color: var(--text-mid); margin: 0 0 20px; line-height: 1.5; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 12px 28px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; text-decoration: none; transition: all 0.2s; cursor: pointer; border: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-dark); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-teal { background: var(--accent-teal); color: #fff; }
.btn-teal:hover { background: #2C7A7B; transform: translateY(-1px); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 18px; font-size: 0.8rem; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #1A202C; }

/* === SECTION === */
.section { padding: 60px 0; }
.section-label { text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.75rem; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.section-title { text-align: center; font-size: 1.75rem; font-weight: 800; margin: 0 0 36px; }
.section-desc { text-align: center; color: var(--text-mid); max-width: 540px; margin: -24px auto 36px; font-size: 1rem; }

/* === FEATURES === */
.feature-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
@media (max-width: 768px) { .feature-cards { grid-template-columns: 1fr; } }
.feature-card { background: var(--bg-white); padding: 32px 24px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h4 { font-weight: 700; margin: 0 0 6px; font-size: 1.05rem; }
.feature-card p { color: var(--text-mid); font-size: 0.9rem; line-height: 1.5; margin: 0; }

/* === USER CARDS === */
.user-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
@media (max-width: 768px) { .user-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .user-grid { grid-template-columns: 1fr; } }
.user-card { background: var(--bg-white); padding: 24px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.user-icon { font-size: 2rem; margin-bottom: 10px; }
.user-card h4 { font-weight: 700; margin: 0 0 4px; font-size: 0.95rem; }
.user-card p { color: var(--text-mid); font-size: 0.85rem; margin: 0; line-height: 1.4; }

/* === PRICING === */
.pricing-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; max-width: 900px; margin: 0 auto; }
@media (max-width: 768px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card { background: var(--bg-white); border-radius: var(--radius); padding: 32px 24px; box-shadow: var(--shadow); text-align: center; position: relative; display: flex; flex-direction: column; }
.pricing-card.featured { border: 2px solid var(--primary); transform: scale(1.02); }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 4px 18px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.pricing-name { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.pricing-price { font-size: 2.2rem; font-weight: 800; margin: 12px 0; }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-mid); }
.pricing-desc { font-size: 0.85rem; color: var(--text-mid); margin-bottom: 16px; }
.pricing-features { list-style: none; padding: 0; margin: 16px 0 24px; text-align: left; flex: 1; }
.pricing-features li { padding: 7px 0; font-size: 0.85rem; color: var(--text-mid); display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: "✓"; color: var(--accent-jade); font-weight: 700; font-size: 0.9rem; }
.pricing-features li.missing { opacity: 0.4; }
.pricing-features li.missing::before { content: "—"; color: var(--text-light); }

/* === ONE-TIME PURCHASE === */
.one-time { padding: 40px 0; }
.one-time h2 { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; }
.one-time-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; max-width: 800px; margin: 0 auto; }
@media (max-width: 640px) { .one-time-grid { grid-template-columns: repeat(2,1fr); } }
.one-time-card { background: var(--bg-white); padding: 24px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.one-time-card .price { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.one-time-card p { font-size: 0.85rem; color: var(--text-mid); margin: 0; }

/* === TESTIMONIALS === */
.testimonial-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
@media (max-width: 640px) { .testimonial-grid { grid-template-columns: 1fr; } }
.testimonial-card { background: var(--bg-white); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); }
.testimonial-card .gold { color: var(--accent-gold); font-size: 1rem; margin-bottom: 8px; }
.testimonial-card .meta { font-style: italic; color: var(--text-mid); line-height: 1.6; margin: 0 0 12px; font-size: 0.9rem; }
.testimonial-author { font-weight: 600; font-size: 0.85rem; }
.testimonial-author span { font-weight: 400; color: var(--text-mid); }

/* === BLOG === */
.blog-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
@media (max-width: 768px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-card { background: var(--bg-white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.blog-card-img { height: 170px; background: linear-gradient(135deg, var(--primary-light), #E8D5C4); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.blog-card-body { padding: 20px; }
.blog-tags { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.blog-tag { font-size: 0.7rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; background: var(--primary-light); padding: 2px 8px; border-radius: 4px; }
.blog-card-body h4 { font-size: 1rem; font-weight: 700; margin: 0 0 6px; }
.blog-card-body h4 a { color: var(--text-dark); text-decoration: none; }
.blog-card-body h4 a:hover { color: var(--primary); }
.blog-card-body .meta { font-size: 0.8rem; color: var(--text-light); margin-bottom: 8px; }
.blog-card-body .excerpt { font-size: 0.85rem; color: var(--text-mid); line-height: 1.5; margin: 0 0 12px; }
.blog-card-body .read-more { font-size: 0.85rem; color: var(--primary); font-weight: 600; text-decoration: none; }
.blog-card-body .read-more:hover { text-decoration: underline; }
.blog-tags .tag { background: var(--primary-light); color: var(--primary); padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }

/* === FAQ === */
.faq-list { max-width: 700px; margin: 0 auto; }
.faq-item { background: var(--bg-white); border-radius: var(--radius-sm); margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden; }
.faq-question { padding: 18px 22px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.faq-question:hover { background: var(--primary-light); }
.faq-question .arrow { transition: transform 0.2s; font-size: 0.8rem; }
.faq-item.open .faq-question .arrow { transform: rotate(180deg); }
.faq-answer { padding: 0 22px; max-height: 0; overflow: hidden; transition: all 0.3s; color: var(--text-mid); line-height: 1.6; font-size: 0.9rem; }
.faq-item.open .faq-answer { padding: 0 22px 18px; max-height: 600px; }

/* === ABOUT === */
.about-hero { text-align: center; padding: 48px 0; }
.about-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.about-hero p { color: var(--text-mid); max-width: 600px; margin: 0 auto; }
.about-story { max-width: 680px; margin: 0 auto; padding: 0 24px 40px; }
.about-story p { line-height: 1.8; color: var(--text-mid); margin-bottom: 16px; }
.values-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; max-width: 800px; margin: 0 auto; padding: 0 24px 48px; }
@media (max-width: 640px) { .values-grid { grid-template-columns: 1fr; } }
.value-card { background: var(--bg-white); padding: 28px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.value-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.value-card p { color: var(--text-mid); font-size: 0.9rem; line-height: 1.5; margin: 0; }

/* === TOOL LAYOUT === */
.tool-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 0 24px 60px; max-width: 1100px; margin: 0 auto; }
@media (max-width: 768px) { .tool-layout { grid-template-columns: 1fr; } }
.tool-sidebar { background: var(--bg-white); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); align-self: start; }
.tool-main { min-height: 400px; }
.tool-sidebar label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; color: var(--text-dark); }
.tool-sidebar .form-group { margin-bottom: 18px; }
.tool-sidebar input, .tool-sidebar select, .tool-sidebar textarea { width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-dark); background: var(--bg-white); font-family: inherit; transition: border-color 0.2s; }
.tool-sidebar input:focus, .tool-sidebar select:focus, .tool-sidebar textarea:focus { outline: none; border-color: var(--primary); }
.tool-sidebar textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.radio-group { display: flex; gap: 14px; }
.radio-group label { font-weight: 400 !important; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-group input[type="radio"] { width: auto; accent-color: var(--primary); }
.required { color: var(--primary); }

/* === TOOL RESULTS === */
.tool-main { background: var(--bg-white); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); }
.placeholder-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; color: var(--text-light); text-align: center; }
.placeholder-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }

/* === BAZI CHART === */
.bazi-chart { margin-bottom: 20px; }
.bazi-chart table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.bazi-chart th, .bazi-chart td { border: 1px solid var(--border); padding: 10px 6px; text-align: center; }
.bazi-chart th { background: var(--primary-light); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
.pillar-cell { font-weight: 700; font-size: 1.05rem; }
.heaven-stem { color: var(--primary); }
.earth-branch { color: var(--accent-jade); }
.zodiac-cell { color: var(--text-mid); font-size: 0.8rem; }

/* === ELEMENTS CHART === */
.elements-chart { margin-bottom: 20px; }
.elements-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-label { width: 24px; font-weight: 700; font-size: 0.85rem; text-align: center; }
.bar-track { flex: 1; height: 20px; background: #EDF2F7; border-radius: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; transition: width 0.5s; }
.bar-fill.wood { background: linear-gradient(90deg,#48BB78,#38A169); }
.bar-fill.fire { background: linear-gradient(90deg,#FC8181,#E53E3E); }
.bar-fill.earth { background: linear-gradient(90deg,#D69E2E,#B7791F); }
.bar-fill.metal { background: linear-gradient(90deg,#A0AEC0,#718096); }
.bar-fill.water { background: linear-gradient(90deg,#63B3ED,#3182CE); }
.bar-value { font-size: 0.8rem; font-weight: 600; min-width: 36px; color: var(--text-mid); }

/* === NAME CARDS === */
.name-cards { margin-top: 20px; }
.name-card { display: flex; align-items: center; background: var(--primary-light); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 8px; gap: 14px; }
.name-chinese { font-size: 1.6rem; font-weight: 800; color: var(--primary); min-width: 60px; text-align: center; }
.name-info { flex: 1; }
.name-pinyin { font-weight: 600; font-size: 0.9rem; color: var(--text-dark); }
.name-meaning { font-size: 0.8rem; color: var(--text-mid); margin-top: 2px; line-height: 1.3; }
.name-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.name-tag { background: #fff; padding: 2px 10px; border-radius: 12px; font-size: 0.7rem; color: var(--text-mid); border: 1px solid var(--border); }
.name-score { font-weight: 800; color: var(--accent-gold); min-width: 36px; text-align: center; font-size: 1.1rem; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; justify-content: center; }

/* === CONTACT === */
.contact-section { padding: 48px 24px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 800px; margin: 0 auto; }
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-info h3 { font-weight: 700; font-size: 1.1rem; margin-bottom: 20px; }
.contact-item { display: flex; gap: 14px; margin-bottom: 20px; }
.contact-item .icon { font-size: 1.3rem; min-width: 32px; }
.contact-item p { margin: 0; font-size: 0.9rem; color: var(--text-mid); line-height: 1.5; }
.contact-item strong { color: var(--text-dark); }

/* === PAGE CONTENT === */
.page-content { max-width: 700px; margin: 0 auto; padding: 40px 24px; }
.page-content h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 20px; }
.page-content h2 { font-size: 1.25rem; font-weight: 700; margin: 28px 0 12px; }
.page-content h3 { font-size: 1.05rem; font-weight: 600; margin: 20px 0 8px; }
.page-content p { line-height: 1.7; color: var(--text-mid); margin-bottom: 14px; font-size: 0.95rem; }
.page-content ul, .page-content ol { line-height: 1.7; color: var(--text-mid); padding-left: 22px; margin-bottom: 14px; }
.page-content li { margin-bottom: 6px; }

/* === PAGE 404 === */
.page-404 { text-align: center; padding: 80px 24px; }
.page-404 h1 { font-size: 4rem; font-weight: 800; color: var(--primary); margin: 0 0 12px; }
.page-404 p { color: var(--text-mid); margin-bottom: 24px; }

/* === PAGE HEADER === */
.page-header { background: var(--bg-white); border-bottom: 1px solid var(--border); text-align: center; padding: 40px 0; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; margin: 0 0 8px; }
.page-header p { color: var(--text-mid); max-width: 500px; margin: 0 auto; font-size: 0.95rem; }

/* === COOKIE BANNER === */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--secondary); color: #fff; padding: 14px 24px; z-index: 200; display: none; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cookie-banner p { margin: 0; font-size: 0.8rem; color: rgba(255,255,255,0.85); line-height: 1.4; }
.cookie-banner a { color: var(--accent-gold); }
.cookie-btn { background: var(--primary); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.8rem; white-space: nowrap; }

/* === FOOTER === */
.footer { background: var(--secondary); color: #fff; padding: 48px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer h4 { font-size: 0.9rem; font-weight: 700; margin: 0 0 14px; color: #fff; }
.footer a { font-size: 0.85rem; color: rgba(255,255,255,0.65); text-decoration: none; display: block; line-height: 1.8; }
.footer a:hover { color: #fff; }
.footer-brand .logo { font-size: 1.2rem; font-weight: 800; color: #fff; margin-bottom: 10px; }
.footer-brand p { font-size: 0.85rem; color: rgba(255,255,255,0.5); line-height: 1.6; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 32px; padding: 20px 0; text-align: center; font-size: 0.8rem; color: rgba(255,255,255,0.4); }

/* === TOAST === */
.toast { position: fixed; top: 80px; right: 20px; padding: 12px 22px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; z-index: 999; transform: translateX(400px); transition: transform 0.3s; max-width: 340px; }
.toast.show { transform: translateX(0); }
.toast.success { background: #F0FFF4; border: 1px solid #C6F6D5; color: #276749; }
.toast.error { background: #FFF5F5; border: 1px solid #FED7D7; color: #9B2C2C; }
.toast.info { background: #EBF8FF; border: 1px solid #BEE3F8; color: #2B6CB0; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .section { padding: 40px 0; }
  .hero { padding: 40px 0 24px; }
  .page-content { padding: 24px 20px; }
}

#worksheet-canvas { width: 100%; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; margin: 12px 0; background: #fff; }
.has-content #worksheet-canvas { min-height: 200px; }
