# -*- coding: utf-8 -*-
import io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

CSS = """<style>
:root{--bg:#f6f7fb;--card:#fff;--ink:#1f2330;--muted:#6b7280;--line:#e5e7eb;--accent:#7c3aed;--accent2:#0ea5e9;--chip:#eef2ff;--ok:#10b981;--warn:#f59e0b;}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--ink);line-height:1.65}
.wrap{max-width:1080px;margin:0 auto;padding:24px}
.crumb{font-size:13px;color:var(--muted);margin-bottom:12px}
.crumb a{color:var(--accent);text-decoration:none}
h1{font-size:26px;margin:0 0 6px}
.sub{color:var(--muted);font-size:14px;margin-bottom:18px}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 20px}
.chip{background:var(--chip);color:var(--accent);padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:18px 20px}
.card h2{font-size:16px;margin:0 0 10px;color:var(--accent);border-left:3px solid var(--accent);padding-left:8px}
.kv{display:grid;grid-template-columns:110px 1fr;gap:6px 10px;font-size:14px}
.kv .k{color:var(--muted)}
ul{margin:6px 0;padding-left:20px}
.back{display:inline-block;margin-top:20px;padding:10px 18px;background:var(--accent);color:#fff;border-radius:8px;text-decoration:none;font-size:14px}
.note{background:#fffbeb;border:1px solid #fde68a;border-radius:8px;padding:10px 14px;font-size:13px;color:#92400e;margin-top:16px}
@media(max-width:760px){.grid{grid-template-columns:1fr}}
</style>"""

def page(crumb, title, sub, chips, kvs, cards, note):
    chips_html = "".join(f'<span class="chip">{c}</span>' for c in chips)
    kvs_html = "".join(f'<div class="kv"><span class="k">{k}</span><span>{v}</span></div>' for k, v in kvs)
    cards_html = ""
    for h2, items in cards:
        lis = "".join(f"<li>{it}</li>" for it in items)
        cards_html += f'<div class="card"><h2>{h2}</h2><ul>{lis}</ul></div>'
    return f"""<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>{title} · 美加研究生项目查询库</title>
{CSS}
</head>
<body><div class="wrap">
<div class="crumb"><a href="../index_main.html">← 返回项目库</a> · {crumb}</div>
<h1>{title}</h1>
<div class="sub">{sub}</div>
<div class="chips">{chips_html}</div>
<div class="grid">{kvs_html}{cards_html}</div>
<div class="note">{note}</div>
<a class="back" href="../index_main.html">返回项目库列表</a>
</div></body></html>"""

pages = []

# 1. Genetic Counseling MSGC
pages.append(("details/up-msgc.html", page(
    "宾夕法尼亚大学 UPenn · 遗传咨询理学硕士",
    "MS in Genetic Counseling（遗传咨询理学硕士）",
    "宾夕法尼亚大学 UPenn · 遗传咨询理学硕士",
    ["Perelman 医学院", "遗传咨询/基因组学", "STEM", "18.5 CU · 含 Thesis", "ACGC 认证"],
    [
        ("学位", "MSGC（Master of Science in Genetic Counseling）"),
        ("学制", "18.5 course units · 含临床实习 + 硕士论文"),
        ("所属", "Perelman School of Medicine"),
        ("STEM", "STEM-designated（基因组学/遗传医学类）"),
        ("截止/语言/学费", "catalog 未公布，待补"),
        ("培养定位", "ACGC 认证遗传咨询师培养项目；毕业生可参加 ABGC 认证考试并申请州执照"),
    ],
    [
        ("核心课程", [
            "Advanced Genetics and Genomics（高级遗传与基因组学）",
            "Mechanisms of Disease（疾病机制）",
            "Introduction to Genetic Counseling（遗传咨询导论）",
            "Foundations of Clinical Genetics and Genomic Technologies",
            "Reproductive and Developmental Genetics（生殖与发育遗传）",
            "Cancer Genetics（肿瘤遗传）",
            "Genetic Counseling Theory and Practice I",
            "Medical Genetics I/II",
        ]),
        ("研究方向", [
            "临床遗传咨询（产前/儿科/成人/肿瘤）",
            "基因组检测技术与解读",
            "遗传咨询研究方法与论文",
            "患者心理社会评估与伦理",
        ]),
        ("实践", [
            "Penn Medicine 与 Children's Hospital of Philadelphia 临床实习",
            "遗传咨询轮诊（Genetic Counseling Rounds）",
            "个人研究型硕士论文（Master Thesis）",
            "专业发展研讨与患者倡导实践",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；ACGC 认证项目；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/genetic-counseling-msgc/"
)))

# 2. Clinical Epidemiology MSCE
pages.append(("details/up-msce.html", page(
    "宾夕法尼亚大学 UPenn · 临床流行病学理学硕士",
    "MS in Clinical Epidemiology（临床流行病学理学硕士）",
    "宾夕法尼亚大学 UPenn · 临床流行病学理学硕士",
    ["Perelman 医学院 · 临床流行病学与生物统计中心", "流行病学/生物统计", "STEM", "14 CU · 含 Thesis"],
    [
        ("学位", "MSCE（Master of Science in Clinical Epidemiology）"),
        ("学制", "14 course units · 含导师指导论文（2.5-4.5 CU Thesis）"),
        ("所属", "Perelman School of Medicine · Center for Clinical Epidemiology and Biostatistics (CCEB)"),
        ("STEM", "STEM-designated（流行病学/生物统计类）"),
        ("截止/语言/学费", "catalog 未公布，待补"),
        ("培养定位", "面向已持有医学/护理/其他健康领域高级学位者的密集型学术研究硕士；培养临床研究方法学人才"),
    ],
    [
        ("核心课程", [
            "Introductory Epidemiology（流行病学导论）",
            "Biostatistics for Epidemiologic Methods I & II（流行病学方法用生物统计 I/II）",
            "Data Management and Visualization I & II（数据管理与可视化）",
            "Measurement of Health in Epidemiology（健康测量）",
            "Clinical Database Research Methodology（临床数据库研究方法）",
            "Issues in Research Protocol Development（研究方案设计）",
            "Critical Appraisal of the Medical Literature（医学文献严格评价）",
            "Advanced Topics in Epidemiology（流行病学高级专题）",
            "Tutorial in Epidemiologic Research（流行病学研究指导）",
        ]),
        ("研究方向", [
            "临床流行病学研究设计",
            "临床数据库与真实世界研究",
            "生物统计与数据分析",
            "导师指导下的临床研究论文",
        ]),
        ("实践/要求", [
            "主导师 + 导师团队密切指导",
            "Master's Thesis I-V（EPID 9900）",
            "MSCE 综合考试 + 论文终期答辩",
            "HIPAA/CITI 培训、IRB 审批、CCEB 研讨会（25 次）",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；面向已有医学/护理/健康领域高级学位申请者；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/clinical-epidemiology-msce/"
)))

# 3. Healthcare Quality and Safety MHQS
pages.append(("details/up-mhqs.html", page(
    "宾夕法尼亚大学 UPenn · 医疗质量与安全硕士",
    "Master of Healthcare Quality and Safety（医疗质量与安全硕士）",
    "宾夕法尼亚大学 UPenn · 医疗质量与安全硕士",
    ["Perelman 医学院 · CHiPS 中心", "医疗管理/患者安全", "10 CU", "Full Time / Part Time"],
    [
        ("学位", "MHQS（Master of Healthcare Quality and Safety）"),
        ("学制", "10 course units · 4 学期（Fall 3 / Spring 3 / Fall 2 / Spring 2）"),
        ("所属", "Perelman School of Medicine · Center for Healthcare Innovation and Patient Safety (CHiPS)"),
        ("STEM", "非 STEM-designated（医疗管理/患者安全类）"),
        ("截止/语言/学费", "catalog 未公布，待补"),
        ("培养定位", "培养医疗质量与患者安全领域下一代领导者；面向在职医疗专业人士，可走全日制或兼读路径"),
    ],
    [
        ("核心课程", [
            "Principles and Practice of Healthcare Quality Improvement I & II",
            "Systems Thinking in Patient Safety（患者安全系统思维）",
            "Evaluating Quality Improvement and Patient Safety Programs",
            "The Business of Healthcare: Connecting Quality to Strategy and Finance",
            "Applied Clinical Informatics in Quality Improvement",
            "Safety and Quality Leadership in Healthcare Systems",
            "Using Quality Improvement to Achieve Health Equity",
            "Quality Improvement Capstone（质量改进顶石项目）",
        ]),
        ("职业方向", [
            "医疗系统/医院质量与安全总监",
            "人群健康（Population Health）",
            "健康公平（Health Equity）",
            "患者安全（Patient Safety）",
            "价值医疗（Value-Based Care）",
        ]),
        ("实践", [
            "Quality Improvement Capstone（应用顶石项目）",
            "与在职医疗专业人士同堂学习",
            "可结合临床/学术职业路径",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；提供 Full Time 与 Part Time 双路径；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/healthcare-quality-safety-mhqs/"
)))

# 4. Bioethics MBE
pages.append(("details/up-mbe.html", page(
    "宾夕法尼亚大学 UPenn · 生物伦理硕士",
    "Master of Bioethics（生物伦理硕士）",
    "宾夕法尼亚大学 UPenn · 生物伦理硕士",
    ["Perelman 医学院 · 医学伦理与健康政策系", "生物伦理/健康政策", "9 CU", "Full Time / Part Time"],
    [
        ("学位", "MBE（Master of Bioethics）"),
        ("学制", "9 course units · 全日制 1 年（Fall 3 / Spring 4 / Summer 2）"),
        ("所属", "Perelman School of Medicine · Department of Medical Ethics & Health Policy"),
        ("STEM", "非 STEM-designated（伦理/政策/人文类）"),
        ("截止/语言/学费", "catalog 未公布，待补"),
        ("培养定位", "跨学科生物伦理学位；面向医疗/法律/护理/社工/遗传咨询/监管/公共政策/兽医等领域从业者，以及宾大其他专业学位在读生"),
    ],
    [
        ("核心课程", [
            "Conceptual Foundations in Bioethics（生物伦理概念基础）",
            "MBE/MSME Proseminar（生物伦理研讨课）",
            "Rationing & Resource Allocation（资源分配与配给）",
            "Research Ethics（研究伦理）",
            "Clinical Ethics（临床伦理）",
            "6 学分选修（含 Introduction to Bioethics、Capstone Seminar、Mentored Research）",
        ]),
        ("方向模块", [
            "政策伦理（Policy）：资源分配与卫生政策",
            "研究伦理（Research Ethics）：IRB、人类受试者研究",
            "临床伦理（Clinical Ethics）：临床伦理会诊、生命伦理决策",
        ]),
        ("项目特色", [
            "跨学科：医学/法律/护理/社工/遗传咨询/监管/兽医",
            "可与宾大医学/法律/护理/PhD 项目双学位或联合修读",
            "宾大本科生 submatriculation 通道（需 3.5 GPA）",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；提供 Full Time 与 Part Time 双路径；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/bioethics-mbe/"
)))

# 5. Chemical Sciences MCS
pages.append(("details/up-mcs.html", page(
    "宾夕法尼亚大学 UPenn · 化学科学硕士",
    "Master of Chemical Sciences（化学科学硕士）",
    "宾夕法尼亚大学 UPenn · 化学科学硕士",
    ["SAS LPS 学院 · 化学系", "化学/材料科学", "STEM", "全日制 2 年"],
    [
        ("学位", "MCS（Master of Chemical Sciences）"),
        ("学制", "全日制 2 年（也可兼读）"),
        ("所属", "College of Liberal and Professional Studies (LPS) · Department of Chemistry"),
        ("STEM", "STEM-designated（化学/材料科学类）"),
        ("截止/语言/学费", "catalog 未公布，待补"),
        ("培养定位", "面向化学领域从业者或拟进入化学行业者的专业硕士；提供核心浓度课 + 选修，含研究/顶石/独立研究"),
    ],
    [
        ("核心方向", [
            "Biological Chemistry（生物化学）",
            "Inorganic Chemistry（无机化学）",
            "Organic Chemistry（有机化学）",
            "Physical Chemistry（物理化学）",
            "Environmental Chemistry（环境化学）",
            "Materials（材料科学）",
        ]),
        ("培养方式", [
            "核心浓度课 + 定制选修组合",
            "可在研究、顶石（Capstone）或独立研究中与宾大实验室/本地及全国合作伙伴完成",
            "为在职化学行业人士提供可边工作边完成研究部分的灵活路径",
        ]),
        ("职业方向", [
            "化工/制药/材料行业研发",
            "环境与检测实验室",
            "继续攻读 PhD",
            "化学行业咨询与监管",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；LPS 学院专业硕士；提供全日制与兼读路径；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/chemical-sciences-mcs/"
)))

for path, content in pages:
    with open(path, "w", encoding="utf-8") as f:
        f.write(content)
    print(f"WROTE {path} {len(content)}")
