commit e32c0a57e5353a35c8051eef415a0edaacfd1f4e
Author: Hardwell99 <3022256519@qq.com>
Date: Wed Nov 18 11:46:50 2026 +0800
first commit
初次提交
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..4ee3406
--- /dev/null
+++ b/index.html
@@ -0,0 +1,88 @@
+
+
+
+
+
+ JISOO — Music Album
+
+
+
+
+
+ JISOO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
SETTINGS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..81a8001
--- /dev/null
+++ b/script.js
@@ -0,0 +1,425 @@
+(function () {
+ "use strict";
+
+ /*
+ * 图片清单:路径 + 尺寸 + 预计算的 alpha 有效区域(原图像素坐标)。
+ * 由 update-photos.js 生成;新增图片后运行 node update-photos.js 更新。
+ */
+ var photos = [
+ {
+ src: "assets/images/1793460705640_cutout.png",
+ width: 1440,
+ height: 1920,
+ bounds: { x: 305, y: 123, w: 996, h: 1797 },
+ },
+ {
+ src: "assets/images/1794486619061_cutout.png",
+ width: 1440,
+ height: 1920,
+ bounds: { x: 467, y: 62, w: 935, h: 1858 },
+ },
+ {
+ src: "assets/images/RDT_20261114_1838401112059065207923484_cutout.png",
+ width: 3000,
+ height: 2000,
+ bounds: { x: 873, y: 8, w: 1445, h: 1992 },
+ },
+ {
+ src: "assets/images/RDT_20261114_1839131355937088287474941_cutout.png",
+ width: 3000,
+ height: 2000,
+ bounds: { x: 1070, y: 124, w: 1479, h: 1876 },
+ },
+ {
+ src: "assets/images/VOSR2_upscaled_x2_HW_VVskbYAE60Oo_20261117_212857_cutout (1).png",
+ width: 3840,
+ height: 2160,
+ bounds: { x: 895, y: 41, w: 2469, h: 2119 },
+ },
+ {
+ src: "assets/images/VOSR2_upscaled_x2_RDT_20261114_1838498_20261117_214156_cutout.png",
+ width: 2250,
+ height: 4000,
+ bounds: { x: 337, y: 302, w: 1768, h: 3698 },
+ },
+ {
+ src: "assets/images/image_1793460860160_cutout.png",
+ width: 2000,
+ height: 3000,
+ bounds: { x: 537, y: 676, w: 1270, h: 2324 },
+ },
+ {
+ src: "assets/images/img_1794745307856d2147457d0c9917d6369b4620d7e7d18b83ba2cee8439b3300c64c4aee64bb5_cutout.png",
+ width: 4000,
+ height: 6000,
+ bounds: { x: 103, y: 681, w: 3823, h: 5319 },
+ },
+ ];
+ /* PHOTOS_END */
+
+ /*
+ * 字体注册表:由 update-fonts.js 扫描 assets/font 生成。
+ * file 指向 assets/font 下的字体文件;留空时用 stack 回退。
+ */
+ /* FONTS_START */
+ var FONTS = [
+ { id: "Didot Bold", label: "Didot Bold", file: "assets/font/Didot Bold.otf", stack: "Georgia, \"Times New Roman\", serif" },
+ { id: "Didot Italic", label: "Didot Italic", file: "assets/font/Didot Italic.otf", stack: "Georgia, \"Times New Roman\", serif" },
+ { id: "Didot Title", label: "Didot Title", file: "assets/font/Didot Title.otf", stack: "Georgia, \"Times New Roman\", serif" },
+ { id: "Didot", label: "Didot", file: "assets/font/Didot.otf", stack: "Georgia, \"Times New Roman\", serif" },
+ ];
+ /* FONTS_END */
+
+ var POSITIONS = [
+ { id: "tl", label: "左上" },
+ { id: "ml", label: "左中" },
+ { id: "bl", label: "左下" },
+ { id: "tc", label: "中上" },
+ { id: "bc", label: "中下" },
+ { id: "tr", label: "右上" },
+ { id: "br", label: "右下" },
+ ];
+
+ var DIRECTIONS = [
+ { id: "h", label: "横向" },
+ { id: "v", label: "竖向" },
+ { id: "vr", label: "竖向反转" },
+ ];
+
+ function steps(from, to, step, suffix) {
+ var list = [];
+ for (var n = from; n <= to; n += step) {
+ list.push({ id: String(n), label: n + (suffix || "") });
+ }
+ return list;
+ }
+
+ var SIZES = steps(100, 400, 50, "");
+ var SCALES = steps(80, 150, 10, "%");
+
+ var STORAGE_KEY = "jisoo-album-settings";
+ var defaults = {
+ text: " ", font: "Didot Title", pos: "tl", dir: "h", size: 100, spacing: 0.02, scale: 100,
+ };
+ var LIMITS = {
+ spacing: { min: -0.1, max: 0.5 },
+ };
+
+ var stage = document.getElementById("stage");
+ var statusEl = document.getElementById("status");
+ var prevBtn = document.getElementById("prev");
+ var nextBtn = document.getElementById("next");
+ var titleEl = document.getElementById("title");
+ var titleTextEl = document.getElementById("titleText");
+ var settingsEl = document.getElementById("settings");
+ var settingsBtn = document.getElementById("settingsBtn");
+ var settingsClose = document.getElementById("settingsClose");
+ var textInput = document.getElementById("textInput");
+ var spacingInput = document.getElementById("spacingInput");
+ var spacingValue = document.getElementById("spacingValue");
+ var fontChoices = document.getElementById("fontChoices");
+ var sizeChoices = document.getElementById("sizeChoices");
+ var positionChoices = document.getElementById("positionChoices");
+ var directionChoices = document.getElementById("directionChoices");
+ var scaleChoices = document.getElementById("scaleChoices");
+
+ var slides = [];
+ var current = 0;
+ var config = loadConfig();
+
+ function showStatus(message) {
+ statusEl.textContent = message;
+ statusEl.classList.add("is-visible");
+ }
+
+ /*
+ * 有效区域:高度 = 视口高度的 3/4 × 图片缩放比例,宽度按原比例自适应,
+ * 底边贴紧视口底边,水平居中。反推整张
的尺寸与偏移。
+ */
+ function layout() {
+ var vw = window.innerWidth;
+ var vh = window.innerHeight;
+ var targetH = vh * 0.75 * (config.scale / 100);
+
+ slides.forEach(function (slide) {
+ var b = slide.bounds;
+ var scale = targetH / b.h;
+ var renderW = slide.width * scale;
+ var renderH = slide.height * scale;
+ var effectiveW = b.w * scale;
+ var effectiveLeft = (vw - effectiveW) / 2;
+ var effectiveTop = vh - targetH;
+
+ slide.el.style.width = renderW + "px";
+ slide.el.style.height = renderH + "px";
+ slide.el.style.left = effectiveLeft - b.x * scale + "px";
+ slide.el.style.top = effectiveTop - b.y * scale + "px";
+ });
+ }
+
+ function show(index) {
+ if (!slides.length) return;
+ current = (index + slides.length) % slides.length;
+ slides.forEach(function (slide, i) {
+ slide.el.classList.toggle("is-active", i === current);
+ });
+ }
+
+ function loadImage(photo) {
+ return new Promise(function (resolve) {
+ var img = new Image();
+ img.onload = function () {
+ resolve({ photo: photo, img: img });
+ };
+ img.onerror = function () {
+ resolve(null);
+ };
+ img.src = photo.src;
+ });
+ }
+
+ /* -------------------- 设置系统 -------------------- */
+
+ function clampNumber(value, limit, fallback) {
+ var n = Number(value);
+ if (!isFinite(n)) return fallback;
+ return Math.min(limit.max, Math.max(limit.min, n));
+ }
+
+ /* 吸附到最近的档位,避免读到历史配置中的非档位值 */
+ function snapStep(value, options, fallback) {
+ var n = Number(value);
+ if (!isFinite(n)) return fallback;
+ var best = options[0];
+ var bestDist = Math.abs(n - Number(best.id));
+ options.forEach(function (option) {
+ var dist = Math.abs(n - Number(option.id));
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = option;
+ }
+ });
+ return Number(best.id);
+ }
+
+ function loadConfig() {
+ var saved = null;
+ try {
+ saved = JSON.parse(localStorage.getItem(STORAGE_KEY) || "null");
+ } catch (e) {
+ saved = null;
+ }
+ if (!saved || typeof saved !== "object") saved = {};
+
+ var savedFont = typeof saved.font === "string" ? saved.font : defaults.font;
+ var fontExists = FONTS.some(function (f) { return f.id === savedFont; });
+ if (!fontExists) savedFont = defaults.font;
+
+ return {
+ text: typeof saved.text === "string" ? saved.text : defaults.text,
+ font: savedFont,
+ pos: typeof saved.pos === "string" ? saved.pos : defaults.pos,
+ dir: typeof saved.dir === "string" ? saved.dir : defaults.dir,
+ size: snapStep(saved.size, SIZES, defaults.size),
+ spacing: clampNumber(saved.spacing, LIMITS.spacing, defaults.spacing),
+ scale: snapStep(saved.scale, SCALES, defaults.scale),
+ };
+ }
+
+ function saveConfig() {
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
+ } catch (e) {
+ /* file:// 下部分浏览器禁用存储,忽略即可,不影响本次会话 */
+ }
+ }
+
+ function findFont(id) {
+ for (var i = 0; i < FONTS.length; i++) {
+ if (FONTS[i].id === id) return FONTS[i];
+ }
+ return FONTS[0];
+ }
+
+ function fontFormat(file) {
+ var ext = file.split(".").pop().toLowerCase();
+ if (ext === "woff2") return "woff2";
+ if (ext === "woff") return "woff";
+ if (ext === "otf") return "opentype";
+ return "truetype";
+ }
+
+ function injectFontFaces() {
+ var rules = "";
+ FONTS.forEach(function (font) {
+ if (font.file) {
+ rules += '@font-face{font-family:"' + font.id + '";src:url("' + font.file +
+ '") format("' + fontFormat(font.file) + '");font-display:swap;}\n';
+ }
+ });
+ if (!rules) return;
+ var style = document.createElement("style");
+ style.textContent = rules;
+ document.head.appendChild(style);
+ }
+
+ function applyConfig() {
+ var font = findFont(config.font);
+ titleTextEl.textContent = config.text;
+ titleTextEl.style.fontFamily = '"' + font.id + '", ' + font.stack;
+ titleTextEl.style.fontSize = config.size + "px";
+ titleTextEl.style.letterSpacing = config.spacing + "em";
+ titleEl.setAttribute("data-pos", config.pos);
+ titleTextEl.setAttribute("data-dir", config.dir);
+ }
+
+ function renderChoices(container, name, options, currentValue) {
+ container.innerHTML = "";
+ options.forEach(function (option) {
+ var label = document.createElement("label");
+ label.className = "choice";
+
+ var input = document.createElement("input");
+ input.type = "radio";
+ input.name = name;
+ input.value = option.id;
+ input.checked = option.id === currentValue;
+
+ var dot = document.createElement("span");
+ dot.className = "dot";
+
+ var cap = document.createElement("span");
+ cap.className = "cap";
+ cap.textContent = option.label;
+
+ label.appendChild(input);
+ label.appendChild(dot);
+ label.appendChild(cap);
+ container.appendChild(label);
+ });
+ }
+
+ function syncPanel() {
+ textInput.value = config.text;
+ spacingInput.value = config.spacing;
+ spacingValue.textContent = Number(config.spacing).toFixed(2) + " em";
+ renderChoices(fontChoices, "font", FONTS.map(function (f) {
+ return { id: f.id, label: f.label };
+ }), config.font);
+ renderChoices(sizeChoices, "size", SIZES, String(config.size));
+ renderChoices(positionChoices, "position", POSITIONS, config.pos);
+ renderChoices(directionChoices, "direction", DIRECTIONS, config.dir);
+ renderChoices(scaleChoices, "scale", SCALES, String(config.scale));
+ }
+
+ function openSettings() {
+ syncPanel();
+ settingsEl.hidden = false;
+ settingsClose.focus();
+ }
+
+ function closeSettings() {
+ settingsEl.hidden = true;
+ settingsBtn.focus();
+ }
+
+ function initSettings() {
+ injectFontFaces();
+ applyConfig();
+ syncPanel();
+
+ settingsBtn.addEventListener("click", openSettings);
+ settingsClose.addEventListener("click", closeSettings);
+ settingsEl.querySelector(".settings-backdrop").addEventListener("click", closeSettings);
+
+ textInput.addEventListener("input", function () {
+ config.text = textInput.value;
+ applyConfig();
+ saveConfig();
+ });
+
+ spacingInput.addEventListener("input", function () {
+ config.spacing = clampNumber(spacingInput.value, LIMITS.spacing, defaults.spacing);
+ spacingValue.textContent = config.spacing.toFixed(2) + " em";
+ applyConfig();
+ saveConfig();
+ });
+
+ [
+ { el: fontChoices, key: "font", numeric: false },
+ { el: sizeChoices, key: "size", numeric: true },
+ { el: positionChoices, key: "pos", numeric: false },
+ { el: directionChoices, key: "dir", numeric: false },
+ { el: scaleChoices, key: "scale", numeric: true },
+ ].forEach(function (group) {
+ group.el.addEventListener("change", function (e) {
+ if (e.target && e.target.type === "radio") {
+ config[group.key] = group.numeric ? Number(e.target.value) : e.target.value;
+ applyConfig();
+ if (group.key === "scale") layout();
+ saveConfig();
+ }
+ });
+ });
+
+ window.addEventListener("keydown", function (e) {
+ if (e.key === "Escape" && !settingsEl.hidden) {
+ closeSettings();
+ return;
+ }
+ if (!settingsEl.hidden) return;
+ var tag = document.activeElement && document.activeElement.tagName;
+ if (tag === "INPUT" || tag === "TEXTAREA") return;
+ if (e.key === "ArrowLeft") show(current - 1);
+ if (e.key === "ArrowRight") show(current + 1);
+ });
+ }
+
+ function init() {
+ if (!photos.length) {
+ showStatus("图片数组为空:请运行 update-photos.bat 生成。");
+ return;
+ }
+
+ Promise.all(
+ photos.map(function (photo) {
+ return loadImage(photo);
+ })
+ ).then(function (loaded) {
+ var valid = loaded.filter(Boolean);
+
+ if (!valid.length) {
+ showStatus("图片加载失败:请检查 assets/images 目录与路径。");
+ return;
+ }
+
+ valid.forEach(function (item) {
+ var img = item.img;
+ var photo = item.photo;
+ img.className = "slide-img";
+ img.alt = "JISOO album visual";
+ stage.appendChild(img);
+ slides.push({
+ el: img,
+ width: img.naturalWidth || photo.width,
+ height: img.naturalHeight || photo.height,
+ bounds: photo.bounds,
+ });
+ });
+
+ layout();
+ show(0);
+
+ prevBtn.addEventListener("click", function () {
+ show(current - 1);
+ });
+ nextBtn.addEventListener("click", function () {
+ show(current + 1);
+ });
+ window.addEventListener("resize", layout);
+ });
+ }
+
+ initSettings();
+ init();
+})();
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..720222e
--- /dev/null
+++ b/style.css
@@ -0,0 +1,467 @@
+@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;500;600;700;800&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Kalam:wght@700&display=swap");
+
+* {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+ font-family: "Nunito", sans-serif;
+}
+
+html,
+body {
+ position: relative;
+ width: 100%;
+ height: 100vh;
+ overflow: hidden;
+ background-color: #040a22;
+}
+
+/* -------------------- */
+/* TITLE */
+/* 外层只管方位,内层只管字体与方向,避免 transform 互相覆盖 */
+/* -------------------- */
+
+.title {
+ position: fixed;
+ z-index: 1;
+ line-height: 1;
+ pointer-events: none;
+}
+
+.title[data-pos="tl"] { top: 6%; left: 5%; }
+.title[data-pos="ml"] { top: 50%; left: 5%; transform: translateY(-50%); }
+.title[data-pos="bl"] { bottom: 6%; left: 5%; }
+.title[data-pos="tc"] { top: 6%; left: 50%; transform: translateX(-50%); }
+.title[data-pos="bc"] { bottom: 6%; left: 50%; transform: translateX(-50%); }
+.title[data-pos="tr"] { top: 6%; right: 5%; }
+.title[data-pos="br"] { bottom: 6%; right: 5%; }
+
+.title-text {
+ display: block;
+ font-family: "Didot Title", Georgia, "Times New Roman", serif;
+ font-size: 5rem;
+ line-height: 1;
+ color: #fff;
+ letter-spacing: 0.02em;
+ white-space: nowrap;
+}
+
+.title-text[data-dir="v"] {
+ writing-mode: vertical-rl;
+}
+
+.title-text[data-dir="vr"] {
+ writing-mode: vertical-rl;
+ transform: rotate(180deg);
+}
+
+/* -------------------- */
+/* STAGE / BACKGROUND */
+/* -------------------- */
+
+.stage {
+ position: relative;
+ width: 100%;
+ height: 100vh;
+ overflow: hidden;
+}
+
+.gradient {
+ position: absolute;
+ z-index: 0;
+ top: 50%;
+ left: 50%;
+ width: 500px;
+ height: 500px;
+ margin: -250px 0 0 -250px;
+ filter: blur(50px);
+ background-image: linear-gradient(#4ddc9e, #5b37eb, #f1307e);
+ animation: rotate 10s cubic-bezier(0.8, 0.2, 0.2, 0.8) alternate infinite;
+ border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
+}
+
+@keyframes rotate {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
+/* 位置与尺寸由 script.js 按 alpha 有效区域计算后内联写入 */
+.slide-img {
+ position: absolute;
+ display: block;
+ z-index: 2;
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.6s ease;
+}
+
+.slide-img.is-active {
+ opacity: 1;
+}
+
+/* -------------------- */
+/* PREV / NEXT / SETTINGS */
+/* -------------------- */
+
+.nav {
+ position: fixed;
+ top: 50%;
+ right: 3.5%;
+ z-index: 10;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 24px;
+ transform: translateY(-50%);
+}
+
+.nav button {
+ appearance: none;
+ background: transparent;
+ border: 0;
+ padding: 8px;
+ color: rgba(255, 255, 255, 0.32);
+ font-family: "Nunito", sans-serif;
+ font-size: 0.72rem;
+ font-weight: 600;
+ line-height: 1;
+ letter-spacing: 0.26em;
+ text-transform: uppercase;
+ cursor: pointer;
+ transition: color 0.3s ease, transform 0.3s ease;
+}
+
+.nav button:hover,
+.nav button:focus-visible {
+ color: rgba(255, 255, 255, 0.9);
+ outline: none;
+}
+
+.nav button:hover {
+ transform: scale(1.06);
+}
+
+#settingsBtn {
+ margin-top: 6px;
+ padding-top: 16px;
+ border-top: 1px solid rgba(255, 255, 255, 0.12);
+ font-size: 0.62rem;
+ letter-spacing: 0.2em;
+}
+
+/* -------------------- */
+/* SETTINGS OVERLAY */
+/* -------------------- */
+
+.settings[hidden] {
+ display: none;
+}
+
+.settings {
+ position: fixed;
+ inset: 0;
+ z-index: 30;
+ display: grid;
+ place-items: center;
+}
+
+.settings-backdrop {
+ position: absolute;
+ inset: 0;
+ background: rgba(2, 6, 20, 0.66);
+}
+
+.settings-panel {
+ position: relative;
+ width: min(540px, calc(100vw - 32px));
+ max-height: 86vh;
+ overflow-y: auto;
+ padding: 28px 32px 32px;
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 14px;
+ background: #0a1130;
+ box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
+}
+
+.settings-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding-bottom: 18px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
+}
+
+.settings-head h2 {
+ color: #fff;
+ font-size: 0.9rem;
+ font-weight: 700;
+ letter-spacing: 0.3em;
+}
+
+.settings-close {
+ appearance: none;
+ width: 32px;
+ height: 32px;
+ border: 1px solid rgba(255, 255, 255, 0.16);
+ border-radius: 50%;
+ background: transparent;
+ color: rgba(255, 255, 255, 0.7);
+ font-size: 1.3rem;
+ line-height: 1;
+ cursor: pointer;
+ transition: border-color 0.2s, color 0.2s;
+}
+
+.settings-close:hover,
+.settings-close:focus-visible {
+ border-color: rgba(255, 255, 255, 0.6);
+ color: #fff;
+ outline: none;
+}
+
+.settings-group {
+ padding-top: 22px;
+}
+
+.settings-label {
+ margin-bottom: 14px;
+ color: rgba(255, 255, 255, 0.92);
+ font-size: 0.82rem;
+ font-weight: 700;
+ letter-spacing: 0.12em;
+}
+
+.settings-label span {
+ margin-left: 8px;
+ color: rgba(255, 255, 255, 0.32);
+ font-size: 0.62rem;
+ font-weight: 600;
+ letter-spacing: 0.18em;
+}
+
+.field {
+ display: block;
+ margin-bottom: 18px;
+}
+
+.field-name {
+ display: block;
+ margin-bottom: 8px;
+ color: rgba(255, 255, 255, 0.45);
+ font-size: 0.7rem;
+ font-weight: 600;
+ letter-spacing: 0.1em;
+}
+
+.field input[type="text"] {
+ width: 100%;
+ padding: 10px 12px;
+ border: 1px solid rgba(255, 255, 255, 0.18);
+ border-radius: 8px;
+ background: rgba(255, 255, 255, 0.05);
+ color: #fff;
+ font-family: inherit;
+ font-size: 0.95rem;
+ letter-spacing: 0.08em;
+ outline: none;
+ transition: border-color 0.2s;
+}
+
+.field input[type="text"]:focus {
+ border-color: rgba(255, 255, 255, 0.55);
+}
+
+/* 数值滑块:字号 / 字距 */
+.range-field {
+ margin-top: 18px;
+}
+
+.range-field .settings-label {
+ display: flex;
+ align-items: baseline;
+}
+
+.range-field output {
+ margin-left: auto;
+ color: rgba(255, 255, 255, 0.85);
+ font-size: 0.78rem;
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ letter-spacing: 0.04em;
+}
+
+.range-field input[type="range"] {
+ appearance: none;
+ width: 100%;
+ height: 18px;
+ margin: 0;
+ background: transparent;
+ cursor: pointer;
+}
+
+.range-field input[type="range"]::-webkit-slider-runnable-track {
+ height: 3px;
+ border-radius: 2px;
+ background: rgba(255, 255, 255, 0.18);
+}
+
+.range-field input[type="range"]::-webkit-slider-thumb {
+ appearance: none;
+ width: 14px;
+ height: 14px;
+ margin-top: -5.5px;
+ border: 0;
+ border-radius: 50%;
+ background: #fff;
+ transition: transform 0.2s;
+}
+
+.range-field input[type="range"]::-moz-range-track {
+ height: 3px;
+ border-radius: 2px;
+ background: rgba(255, 255, 255, 0.18);
+}
+
+.range-field input[type="range"]::-moz-range-thumb {
+ width: 14px;
+ height: 14px;
+ border: 0;
+ border-radius: 50%;
+ background: #fff;
+}
+
+.range-field input[type="range"]:hover::-webkit-slider-thumb,
+.range-field input[type="range"]:focus-visible::-webkit-slider-thumb {
+ transform: scale(1.25);
+}
+
+.range-field input[type="range"]:focus-visible {
+ outline: none;
+}
+
+/* 圆形复选框:所有组共用同一套 8 列网格,圆点与标签逐列对齐 */
+.choices,
+.choices-grid,
+.choices-steps {
+ display: grid;
+ grid-template-columns: repeat(8, minmax(0, 1fr));
+ gap: 16px 0;
+}
+
+/* 数字档位使用等宽数字,避免位数变化造成抖动 */
+.choices-steps .cap {
+ font-variant-numeric: tabular-nums;
+}
+
+.choice {
+ display: inline-flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 8px;
+ cursor: pointer;
+ user-select: none;
+}
+
+.choice input {
+ position: absolute;
+ width: 0;
+ height: 0;
+ opacity: 0;
+}
+
+.choice .dot {
+ display: grid;
+ place-items: center;
+ width: 22px;
+ height: 22px;
+ border: 1px solid rgba(255, 255, 255, 0.35);
+ border-radius: 50%;
+ transition: border-color 0.2s, background 0.2s;
+}
+
+.choice .dot::after {
+ content: "";
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: transparent;
+ transition: background 0.2s;
+}
+
+.choice input:checked + .dot {
+ border-color: #fff;
+}
+
+.choice input:checked + .dot::after {
+ background: #fff;
+}
+
+.choice input:focus-visible + .dot {
+ outline: 2px solid rgba(255, 255, 255, 0.6);
+ outline-offset: 3px;
+}
+
+.choice .cap {
+ color: rgba(255, 255, 255, 0.48);
+ font-size: 0.68rem;
+ line-height: 1.25;
+ text-align: center;
+ white-space: normal;
+ overflow-wrap: break-word;
+ transition: color 0.2s;
+}
+
+.choice input:checked ~ .cap {
+ color: rgba(255, 255, 255, 0.95);
+}
+
+/* -------------------- */
+/* STATUS / RESPONSIVE */
+/* -------------------- */
+
+.status {
+ position: fixed;
+ left: 50%;
+ bottom: 8%;
+ z-index: 20;
+ display: none;
+ max-width: 80vw;
+ color: rgba(255, 255, 255, 0.7);
+ font-size: 0.85rem;
+ letter-spacing: 0.04em;
+ text-align: center;
+ transform: translateX(-50%);
+}
+
+.status.is-visible {
+ display: block;
+}
+
+@media (max-width: 500px) {
+ .gradient {
+ width: 300px;
+ height: 300px;
+ margin: -150px 0 0 -150px;
+ }
+
+ .nav {
+ right: 5%;
+ gap: 20px;
+ }
+
+ .settings-panel {
+ padding: 24px 20px;
+ }
+
+ .choices,
+ .choices-grid,
+ .choices-steps {
+ gap: 14px 0;
+ }
+
+ .choice .cap {
+ font-size: 0.6rem;
+ letter-spacing: 0;
+ }
+}
diff --git a/update-fonts.js b/update-fonts.js
new file mode 100644
index 0000000..81eb4e9
--- /dev/null
+++ b/update-fonts.js
@@ -0,0 +1,75 @@
+/*
+ * 扫描 assets/font,回写 script.js 中的 FONTS 数组。
+ * 新增/删除字体后运行:node update-fonts.js(或双击 update-photos.bat)
+ */
+const fs = require("fs");
+const path = require("path");
+
+const fontDir = path.join(__dirname, "assets", "font");
+const scriptPath = path.join(__dirname, "script.js");
+const extensions = new Set([".woff2", ".woff", ".ttf", ".otf"]);
+const defaultId = "Didot Title";
+const defaultStack = 'Georgia, "Times New Roman", serif';
+const startMarker = " /* FONTS_START */";
+const endMarker = " /* FONTS_END */";
+
+if (!fs.existsSync(fontDir)) {
+ console.error("未找到字体目录: " + fontDir);
+ process.exit(1);
+}
+
+function labelFromName(name) {
+ return path.basename(name, path.extname(name)).replace(/[_-]+/g, " ").trim();
+}
+
+const items = fs
+ .readdirSync(fontDir)
+ .filter((name) => extensions.has(path.extname(name).toLowerCase()))
+ .sort((a, b) => a.localeCompare(b))
+ .map((name) => ({
+ id: labelFromName(name),
+ file: "assets/font/" + name,
+ stack: defaultStack,
+ }));
+
+const defaultItem = items.find((item) => item.id === defaultId);
+if (defaultItem) {
+ defaultItem.id = defaultId;
+ defaultItem.stack = defaultStack;
+} else {
+ items.unshift({ id: defaultId, file: "", stack: defaultStack });
+}
+
+const lines = items.map(
+ (item) =>
+ " { id: " + JSON.stringify(item.id) +
+ ", label: " + JSON.stringify(item.id) +
+ ", file: " + JSON.stringify(item.file) +
+ ", stack: " + JSON.stringify(item.stack) + " },"
+);
+
+const script = fs.readFileSync(scriptPath, "utf8");
+const eol = script.includes("\r\n") ? "\r\n" : "\n";
+const start = script.indexOf(startMarker);
+const end = script.indexOf(endMarker, start);
+
+if (start < 0 || end < 0) {
+ console.error("script.js 中未找到 FONTS 标记");
+ process.exit(1);
+}
+
+/* 替换从 FONTS_START 到 FONTS_END(含两端标记)的整个区域 */
+const block = [
+ startMarker,
+ " var FONTS = [",
+ ...lines,
+ " ];",
+ endMarker,
+].join(eol);
+
+fs.writeFileSync(
+ scriptPath,
+ script.slice(0, start) + block + script.slice(end + endMarker.length),
+ "utf8"
+);
+console.log(`script.js updated: ${items.length} fonts`);
diff --git a/update-photos.bat b/update-photos.bat
new file mode 100644
index 0000000..eaa094d
--- /dev/null
+++ b/update-photos.bat
@@ -0,0 +1,45 @@
+@echo off
+chcp 65001 >nul
+setlocal enabledelayedexpansion
+
+cd /d "%~dp0"
+
+set "NODE_EXE="
+where node >nul 2>&1 && set "NODE_EXE=node"
+
+if not defined NODE_EXE (
+ set "CURRENT_FILE=%USERPROFILE%\.workbuddy\binaries\node\versions\current"
+ if exist "!CURRENT_FILE!" (
+ set /p NODE_VER=<"!CURRENT_FILE!"
+ set "CANDIDATE=%USERPROFILE%\.workbuddy\binaries\node\versions\!NODE_VER!\node.exe"
+ if exist "!CANDIDATE!" set "NODE_EXE=!CANDIDATE!"
+ )
+)
+
+if not defined NODE_EXE (
+ for /d %%D in ("%USERPROFILE%\.workbuddy\binaries\node\versions\*") do (
+ if exist "%%D\node.exe" set "NODE_EXE=%%D\node.exe"
+ )
+)
+
+if not defined NODE_EXE (
+ echo [ERROR] Node.js not found. Install Node.js or run inside WorkBuddy terminal.
+ pause
+ exit /b 1
+)
+
+echo Updating assets...
+"!NODE_EXE!" "%~dp0update-photos.js"
+if errorlevel 1 goto :failed
+
+"!NODE_EXE!" "%~dp0update-fonts.js"
+if errorlevel 1 goto :failed
+
+echo [DONE] script.js updated. Refresh index.html to see changes.
+pause
+exit /b 0
+
+:failed
+echo [FAILED] Update aborted.
+pause
+exit /b 1
diff --git a/update-photos.js b/update-photos.js
new file mode 100644
index 0000000..ed36ca6
--- /dev/null
+++ b/update-photos.js
@@ -0,0 +1,163 @@
+/*
+ * 扫描 assets/images,重算每张图的尺寸与 alpha 有效区域,
+ * 并回写 script.js 中的 photos 数组。
+ * 新增/删除图片后运行:node update-photos.js(或直接双击 update-photos.bat)
+ */
+const fs = require("fs");
+const path = require("path");
+const zlib = require("zlib");
+
+const imageDir = path.join(__dirname, "assets", "images");
+const scriptPath = path.join(__dirname, "script.js");
+const extensions = new Set([".png", ".jpg", ".jpeg"]);
+
+function readPngMeta(buf) {
+ let pos = 8;
+ let idat = [];
+ let w, h, depth, ctype, interlace;
+
+ while (pos < buf.length) {
+ const len = buf.readUInt32BE(pos);
+ const type = buf.toString("ascii", pos + 4, pos + 8);
+ const chunk = buf.subarray(pos + 8, pos + 8 + len);
+ pos += 12 + len;
+ if (type === "IHDR") {
+ w = chunk.readUInt32BE(0);
+ h = chunk.readUInt32BE(4);
+ depth = chunk[8];
+ ctype = chunk[9];
+ interlace = chunk[12];
+ } else if (type === "IDAT") {
+ idat.push(chunk);
+ } else if (type === "IEND") {
+ break;
+ }
+ }
+
+ const full = { x: 0, y: 0, w, h };
+ if (depth !== 8 || interlace !== 0 || (ctype !== 6 && ctype !== 2)) {
+ return { w, h, bounds: full };
+ }
+
+ const bpp = ctype === 6 ? 4 : 3;
+ const alphaAt = ctype === 6 ? 3 : -1;
+ const raw = zlib.inflateSync(Buffer.concat(idat));
+ const stride = w * bpp;
+ const rows = [];
+ let off = 0;
+ let prev = Buffer.alloc(stride);
+
+ for (let y = 0; y < h; y++) {
+ const ft = raw[off++];
+ const line = Buffer.from(raw.subarray(off, off + stride));
+ off += stride;
+ for (let x = 0; x < stride; x++) {
+ const a = x >= bpp ? line[x - bpp] : 0;
+ const b = prev[x];
+ const c = x >= bpp ? prev[x - bpp] : 0;
+ let v = 0;
+ if (ft === 1) v = a;
+ else if (ft === 2) v = b;
+ else if (ft === 3) v = (a + b) >> 1;
+ else if (ft === 4) {
+ const p = a + b - c;
+ const pa = Math.abs(p - a);
+ const pb = Math.abs(p - b);
+ const pc = Math.abs(p - c);
+ v = pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
+ }
+ line[x] = (line[x] + v) & 0xff;
+ }
+ rows.push(line);
+ prev = line;
+ }
+
+ if (alphaAt < 0) return { w, h, bounds: full };
+
+ let minX = w;
+ let minY = h;
+ let maxX = -1;
+ let maxY = -1;
+ for (let y = 0; y < h; y++) {
+ const row = rows[y];
+ for (let x = 0; x < w; x++) {
+ if (row[x * bpp + alphaAt] > 8) {
+ if (x < minX) minX = x;
+ if (x > maxX) maxX = x;
+ if (y < minY) minY = y;
+ if (y > maxY) maxY = y;
+ }
+ }
+ }
+ if (maxX < 0) return { w, h, bounds: full };
+
+ return {
+ w,
+ h,
+ bounds: { x: minX, y: minY, w: maxX - minX + 1, h: maxY - minY + 1 },
+ };
+}
+
+function readJpegSize(buf) {
+ let i = 2;
+ while (i < buf.length - 9) {
+ if (buf[i] !== 0xff) {
+ i++;
+ continue;
+ }
+ const marker = buf[i + 1];
+ if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) {
+ return { w: buf.readUInt16BE(i + 7), h: buf.readUInt16BE(i + 5) };
+ }
+ i += 2 + buf.readUInt16BE(i + 2);
+ }
+ return null;
+}
+
+const items = fs
+ .readdirSync(imageDir)
+ .filter((name) => extensions.has(path.extname(name).toLowerCase()))
+ .sort()
+ .map((name) => {
+ const buf = fs.readFileSync(path.join(imageDir, name));
+ const meta =
+ path.extname(name).toLowerCase() === ".png"
+ ? readPngMeta(buf)
+ : (() => {
+ const size = readJpegSize(buf) || { w: 0, h: 0 };
+ return { w: size.w, h: size.h, bounds: { x: 0, y: 0, w: size.w, h: size.h } };
+ })();
+ return {
+ src: `assets/images/${name}`,
+ width: meta.w,
+ height: meta.h,
+ bounds: meta.bounds,
+ };
+ })
+ .filter((it) => it.width && it.height);
+
+const lines = items.map(
+ (it) =>
+ [
+ " {",
+ ` src: ${JSON.stringify(it.src)},`,
+ ` width: ${it.width},`,
+ ` height: ${it.height},`,
+ ` bounds: { x: ${it.bounds.x}, y: ${it.bounds.y}, w: ${it.bounds.w}, h: ${it.bounds.h} },`,
+ " },",
+ ].join("\n")
+);
+
+const script = fs.readFileSync(scriptPath, "utf8");
+const eol = script.includes("\r\n") ? "\r\n" : "\n";
+const block = (" var photos = [\n" + lines.join("\n") + "\n ];\n").replace(/\n/g, eol);
+
+const start = script.indexOf(" var photos = [");
+const end = script.indexOf(" /* PHOTOS_END */");
+if (start < 0 || end < 0) {
+ console.error("script.js 中未找到 photos 数组标记");
+ process.exit(1);
+}
+
+fs.writeFileSync(scriptPath, script.slice(0, start) + block + script.slice(end), "utf8");
+console.log(`script.js updated: ${items.length} images`);