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

HEAD = """<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>__TITLE__ · 美加研究生项目查询库</title>
<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>
</head>
<body><div class="wrap">
<div class="crumb"><a href="../index_main.html">← 返回项目库</a> · __CRUMB__</div>
<h1>__H1__</h1>
<div class="sub">__SUB__</div>
<div class="chips">__CHIPS__</div>
<div class="grid">
"""
TAIL = """</div>
<div class="note">__NOTE__</div>
<a class="back" href="../index_main.html">返回项目库列表</a>
</div></body></html>
"""

def page(crumb, title, h1, chips, kvs, items, note, back):
    h = HEAD.replace("__TITLE__",title).replace("__CRUMB__",crumb).replace("__H1__",h1).replace("__SUB__",crumb)
    h = h.replace("__CHIPS__", "".join('<span class="chip">'+c+'</span>' for c in chips))
    out = []
    for k,v in kvs:
        out.append(f'<div class="kv"><span class="k">{k}</span><span>{v}</span></div>')
    for h2, lst in items:
        out.append(f'<div class="card"><h2>{h2}</h2><ul>' + "".join(f"<li>{x}</li>" for x in lst) + "</ul></div>")
    body = "".join(out)
    h = h + body + TAIL.replace("__NOTE__",note).replace("__BACK__",back)
    return h

pages = []

# 1. UPenn AI MSE
pages.append(("details/up-ai-mse.html", page(
    "宾夕法尼亚大学 UPenn · 人工智能工程硕士",
    "UPenn MSE in Artificial Intelligence",
    "MSE in Artificial Intelligence（人工智能工程硕士）",
    ["SEAS 工程学院","CIS 系 / ESE 系","STEM","10 CU","2 年（full-time）"],
    [
        ("学位","MSE（Master of Science in Engineering）"),
        ("学制","10 course units；full-time 约 2 年，part-time 路径最长 4 年"),
        ("所属","SEAS · CIS 计算机与信息科学系 / ESE 系统工程系"),
        ("STEM","STEM-designated（SEAS 工程类）"),
        ("截止/语言/学费","catalog 未公布，待补"),
    ],
    [
        ("核心课程（7 CU）",[
            "CIS 5210 Artificial Intelligence",
            "CIS 5300 Natural Language Processing",
            "CIS 5550 Internet and Web Systems（或 CIS 5690 GPU Computing for ML Systems）",
            "ESE 5410 Machine Learning for Data Science",
            "ESE 5420 Statistics for Data Science",
            "ESE 5460 Principles of Deep Learning",
            "EAS 5240 Technology Ethics and the Legal Landscape",
        ]),
        ("技术选修（2 CU）",[
            "CIS 5030 Algorithms for Big Data",
            "CIS 5530 Networked Systems",
            "CIS 5810 Computer Vision & Computational Photography",
            "CIS 5980 Artificial Intelligence Capstone",
        ]),
        ("自由选修（1 CU）",[
            "任意 SEAS online EAS/CIS/ESE/ENGR 课程，或 HCIN 6022 Digital Health（医学健康技术证书方向）",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/artificial-intelligence-mse/",
    "../index_main.html"
)))

# 2. UPenn MSQF
pages.append(("details/up-msqf.html", page(
    "宾夕法尼亚大学 UPenn · 量化金融硕士",
    "UPenn MS in Quantitative Finance",
    "MS in Quantitative Finance（MSQF 量化金融硕士）",
    ["Wharton 沃顿商学院","STEM","10 CU","前置金融/会计基础"],
    [
        ("学位","MSQF（Master of Science in Quantitative Finance）"),
        ("学制","10 course units（含前置 Foundations 2 CU）"),
        ("所属","Wharton 商学院 · 金融系 FNCE"),
        ("STEM","STEM-designated（量化金融方向）"),
        ("前置要求","入学前或第四学年结束前修完 FNCE 1000 Corporate Finance、ACCT 1010 Accounting and Financial Reporting；并需 MATH 2400 或 ESE 2030"),
        ("截止/语言/学费","catalog 未公布，待补"),
    ],
    [
        ("核心课程（6 CU）",[
            "FNCE 5050 Investment Management（第四学年结束前修完）",
            "FNCE 5170 Financial Derivatives",
            "FNCE 5250 Fixed Income Securities",
            "FNCE 5370 Data Science for Finance",
            "FNCE 5570 Foundations of Asset Pricing",
            "FNCE 5900 Applied Research Practicum",
        ]),
        ("选修方向（4 CU）",[
            "ACCT 5700 Forensic Analytics / 7420 Financial Reporting / 7470 Financial Disclosure Analytics",
            "BEPP 7640 Climate and Financial Markets / 8050 Risk Management",
            "FNCE 5070 Valuation / 5190 Intl Financial Markets & Crypto / 5310 Global Valuation & Risk / 5380 Capital Markets / 5390 Behavioral Finance / 9210 Empirical Methods",
            "OIDD 6530 Math Modeling / 7770 Python for Data Science / 9120 Optimization / 9300 Stochastic Models / 9340 Dynamic Programming",
            "REAL 7210 Real Estate Investment / 8700 Real Estate Data Analytics",
            "STAT 5100 Probability / 5150-5160 Advanced Stat Inference / 5200-5210 Applied Econometrics / 5330 Stochastic / 5350 Forecasting / 5420 Bayesian / 5710 Modern Data Mining / 5900 Causal Inference",
            "可跨选 CIS 5150/5190/5200/5450、CIT 5900/5910、ENM 5310、ESE 5420/5450、MATH 5130/5300/6480/6490",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/quantitative-finance-msqf/",
    "../index_main.html"
)))

# 3. UPenn CGGT MSE
pages.append(("details/up-cggt-mse.html", page(
    "宾夕法尼亚大学 UPenn · 计算机图形与游戏技术工程硕士",
    "UPenn MSE in CGGT",
    "MSE in Computer Graphics and Game Technology（CGGT）",
    ["SEAS 工程学院","CIS 系","STEM","10 CU","设计项目/论文"],
    [
        ("学位","MSE（Master of Science in Engineering）"),
        ("学制","10 course units；9 CU 课程 + 1 学期设计项目（或硕士论文）"),
        ("所属","SEAS · CIS 计算机与信息科学系"),
        ("STEM","STEM-designated（SEAS 工程类）"),
        ("截止/语言/学费","catalog 未公布，待补"),
    ],
    [
        ("核心领域",[
            "DSGN 5005 3-D Computer Modeling（创意艺术与设计）",
            "CIS 5600 Interactive Computer Graphics",
            "CIS 5620 Computer Animation",
            "CIS 6600 Advanced Topics in Computer Graphics and Animation",
            "数学基础 1 CU（建议 CIS 5610/5630/5810/5800、ENM 5030）",
            "ML/AI 1 CU（建议 CIS 5190/5200/6200）",
        ]),
        ("选修",[
            "图形选修 1 CU：CIS 5650 GPU Programming / 5610 / 5630、FNAR 5004 Video I / 5017 Cinema Production / 5025 Computer Animation",
            "技术选修 1 CU：CIS 5610/5630/5810/5800/5190/5200、EAS 5070 IP & Business Law / 5450 Engineering Entrepreneurship、IPD 5150 Product Design、ESE 5050/6190、CIS 5550/5990、CIS 5640 Game Design and Development（暑期）",
            "自由选修 1 CU：EAS 5460 Entrepreneurship II、DSGN 5004 Art of the Web / 5009 Digital Figure Modeling、OIDD 6620 Enabling Technologies、FNAR 5066 Advanced Projects in Animation",
            "顶点：CIS 5680 Game Design Practicum 或 CIS 9990 Master's Thesis",
        ]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/computer-graphics-game-technology-mse/",
    "../index_main.html"
)))

# 4. UPenn MSE-SSC Cybersecurity
pages.append(("details/up-cyber-mse.html", page(
    "宾夕法尼亚大学 UPenn · 软件系统与网络安全工程硕士",
    "UPenn MSE-SSC Cybersecurity",
    "MSE in Software Systems and Cybersecurity（MSE-SSC 网络安全工程硕士）",
    ["SEAS 工程学院","CIS 系","STEM","10 CU","On-Campus"],
    [
        ("学位","MSE（Master of Science in Engineering）"),
        ("学制","10 course units（on-campus 路径；另有 online 路径）"),
        ("所属","SEAS · CIS 计算机与信息科学系"),
        ("STEM","STEM-designated（SEAS 工程类）"),
        ("基础","CIT 5950 Computer Systems Programming（如需要，计入开放选修）"),
        ("截止/语言/学费","catalog 未公布，待补"),
    ],
    [
        ("软件系统核心（3 CU）",[
            "CIS 5050 Software Systems",
            "CIS 5480 Operating Systems Design and Implementation",
            "CIS 5530 Networked Systems（或 CIS 5550 Internet and Web Systems）",
        ]),
        ("网络安全核心（3 CU）",[
            "CIS 5510 Computer and Network Security",
            "CIS 5560 Cryptography",
            "CIS 5580 Secure Software Engineering and Management",
        ]),
        ("技术选修（2 CU）",[
            "CIS 5410 Embedded Software for Life-Critical Applications",
            "CIS 5450 Big Data Analytics",
            "CIS 5470 Software Analysis",
            "CIS 5490 Wireless Communications for Mobile Networks and IoT",
            "CIS 5500 Database and Information Systems",
            "DATS 5750 Cloud Technologies Practicum",
            "EAS 5830 Blockchains",
        ]),
        ("开放选修（2 CU）",["任意 CIS / ESE / EAS 课程；含 S3 Capstone 1 CU 顶点项目"]),
    ],
    "本页为 on-campus 路径（online 路径 catalog 另列）；字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/software-systems-cybersecurity-mse/",
    "../index_main.html"
)))

# 5. UPenn MBIOT
pages.append(("details/up-mbiot.html", page(
    "宾夕法尼亚大学 UPenn · 生物技术硕士",
    "UPenn MBIOT Biotechnology",
    "Masters of Biotechnology（MBIOT 生物技术硕士）",
    ["SEAS 工程学院","CBE / BE 系","STEM","10 CU","生物工程"],
    [
        ("学位","MBIOT（Masters of Biotechnology）"),
        ("学制","10 course units；核心 4 CU + 方向选修 6 CU；其中至少 6 CU 须在 SEAS 内修（BE/BIOT/CBE/CIS/EAS/ENGR/ENM/ESE/IPD/MSE/MEAM）"),
        ("所属","SEAS · 化学与生物分子工程系 CBE / 生物工程系 BE"),
        ("STEM","STEM-designated（生物技术/生物工程类）"),
        ("截止/语言/学费","catalog 未公布，待补"),
    ],
    [
        ("生物核心（3 CU，多选一）",[
            "BE 5260 Immunology for Bioengineers",
            "BE 5400 Principles of Molecular and Cellular Bioengineering",
            "BE 5520 Stem Cells, Proteomics and Drug Delivery",
            "BE 5530 Tissue Engineering",
            "BE 5570 Quantitative Principles of Drug Design",
            "BE 5620 Drug Discovery and Development",
            "BIOL 5062 From Code to Cure: Proteins, Signals, Therapeutic Design",
            "BIOL 5262 Biological Foundations for Bioengineering and Biotechnology: Genomics and Omics",
            "CBE 5170 Principles of Genome Engineering",
            "CBE 5270 Advancements and Applications in Genome Editing",
            "CBE 5540 Engineering Biotechnology",
            "ENGR 5500 Modern Biotechnology for Engineers",
        ]),
        ("实验（1 CU）",[
            "BIOL 5825 Biochemistry and Molecular Genetics Superlab",
            "CBE 5800 Masters Biotechnology Lab Track",
        ]),
        ("方向选修（6 CU）",["跨 SEAS/Perelman 医学院/文理学院生物工程与生物技术相关课程；不可跨课重复计数"]),
    ],
    "本页字段以 UPenn 2026-27 Graduate Catalog 官方项目页为准；截止/语言/学费 catalog 未公布，待补。官网：https://catalog.upenn.edu/graduate/programs/biotechnology-mbiot/",
    "../index_main.html"
)))

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