Upload 3 files
Browse files- index.html +58 -19
- script.js +573 -0
- styles.css +408 -0
index.html
CHANGED
|
@@ -1,19 +1,58 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>EU AI Obligations for Developers - Interactive Flowchart</title>
|
| 7 |
+
<link rel="stylesheet" href="styles.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div class="container">
|
| 11 |
+
<header>
|
| 12 |
+
<h1>EU AI Obligations for Developers</h1>
|
| 13 |
+
<p class="subtitle">Interactive flowchart to determine your obligations under EU AI regulations</p>
|
| 14 |
+
</header>
|
| 15 |
+
|
| 16 |
+
<div class="mode-selector">
|
| 17 |
+
<button id="guided-btn" class="mode-btn active">Guided Mode</button>
|
| 18 |
+
<button id="flowchart-btn" class="mode-btn">Full Flowchart</button>
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div class="content">
|
| 22 |
+
<!-- Guided Mode -->
|
| 23 |
+
<div id="guided-mode" class="guided-mode">
|
| 24 |
+
<div class="navigation-panel">
|
| 25 |
+
<div class="context-section">
|
| 26 |
+
<h3>Context</h3>
|
| 27 |
+
<div class="context-text">You develop a GPAI model</div>
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
<div class="history-section">
|
| 31 |
+
<h3>Decision History</h3>
|
| 32 |
+
</div>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<div class="current-panel">
|
| 36 |
+
<div id="question-container">
|
| 37 |
+
<!-- Dynamic content will be inserted here -->
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<!-- Full Flowchart Mode -->
|
| 43 |
+
<div id="flowchart-mode" class="flowchart-mode hidden">
|
| 44 |
+
<div class="controls">
|
| 45 |
+
<button class="control-btn" onclick="zoomIn()" title="Zoom In">+</button>
|
| 46 |
+
<button class="control-btn" onclick="zoomOut()" title="Zoom Out">−</button>
|
| 47 |
+
<button class="control-btn" onclick="resetView()" title="Reset View">⌂</button>
|
| 48 |
+
</div>
|
| 49 |
+
<div class="flowchart-container" id="flowchart-container">
|
| 50 |
+
<div id="mermaid-container"></div>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<script src="script.js"></script>
|
| 57 |
+
</body>
|
| 58 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Define flowchart data structure
|
| 2 |
+
const flowchartData = {
|
| 3 |
+
q1: {
|
| 4 |
+
text: "Did you develop the GPAI model for the sole purpose of scientific research and development?",
|
| 5 |
+
type: "question",
|
| 6 |
+
context: "You develop a GPAI model",
|
| 7 |
+
choices: [
|
| 8 |
+
{ text: "Yes", next: "outcome_research" },
|
| 9 |
+
{ text: "No", next: "q2" }
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
q2: {
|
| 13 |
+
text: "Have you made the GPAI model available on the EU market including via a commercial activity or via API or open repository?",
|
| 14 |
+
type: "question",
|
| 15 |
+
choices: [
|
| 16 |
+
{ text: "Yes", next: "q3" },
|
| 17 |
+
{ text: "No", next: "outcome_research" }
|
| 18 |
+
]
|
| 19 |
+
},
|
| 20 |
+
q3: {
|
| 21 |
+
text: "Does the GPAI model you've published qualify as posing a potential systemic risk?",
|
| 22 |
+
type: "question",
|
| 23 |
+
choices: [
|
| 24 |
+
{ text: "Yes", next: "outcome_systemic_risk" },
|
| 25 |
+
{ text: "No", next: "q4" }
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
q4: {
|
| 29 |
+
text: "Have you published the GPAI model under a free and open-source license along with documentation about model architecture and usage?",
|
| 30 |
+
type: "question",
|
| 31 |
+
choices: [
|
| 32 |
+
{ text: "Yes", next: "q5" },
|
| 33 |
+
{ text: "No", next: "outcome_gpai_provider_with_obligations" }
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
q5: {
|
| 37 |
+
text: "Are you monetising the GPAI model by making its availability contingent on payment, procuring other products/services, viewing ads, or receiving/processing personal data?",
|
| 38 |
+
type: "question",
|
| 39 |
+
choices: [
|
| 40 |
+
{ text: "Yes", next: "outcome_gpai_provider_with_obligations" },
|
| 41 |
+
{ text: "No", next: "outcome_open_source" }
|
| 42 |
+
]
|
| 43 |
+
},
|
| 44 |
+
outcome_research: {
|
| 45 |
+
text: "You're not a GPAI provider. GPAI provisions do not apply.",
|
| 46 |
+
type: "outcome"
|
| 47 |
+
},
|
| 48 |
+
outcome_systemic_risk: {
|
| 49 |
+
text: "You're a GPAISR provider. Open source exemptions from GPAI provisions do not apply.",
|
| 50 |
+
type: "outcome",
|
| 51 |
+
articles: ["Article 53(1)(a)", "Article 53(1)(b)", "Article 53(1)(c)", "Article 53(1)(d)", "Article 54", "Article 55"],
|
| 52 |
+
additional: "Additional obligations for GPAI with Systemic Risk: Article 55"
|
| 53 |
+
},
|
| 54 |
+
outcome_gpai_provider_with_obligations: {
|
| 55 |
+
text: "You're a GPAI provider. Open source exemptions from GPAI provisions do not apply.",
|
| 56 |
+
type: "outcome",
|
| 57 |
+
class: "gpai",
|
| 58 |
+
articles: ["Article 53(1)(a)", "Article 53(1)(b)", "Article 53(1)(c)", "Article 53(1)(d)", "Article 54"],
|
| 59 |
+
},
|
| 60 |
+
outcome_open_source: {
|
| 61 |
+
text: "You're an open-source GPAI provider. Open source exemptions apply.",
|
| 62 |
+
type: "outcome",
|
| 63 |
+
class: "gpai",
|
| 64 |
+
articles: ["Article 53(1)(a)", "Article 53(1)(b)"],
|
| 65 |
+
}
|
| 66 |
+
};
|
| 67 |
+
|
| 68 |
+
// State variables
|
| 69 |
+
let currentNode = 'q1';
|
| 70 |
+
let navigationHistory = [];
|
| 71 |
+
|
| 72 |
+
// Zoom and pan variables for flowchart
|
| 73 |
+
let scale = 1;
|
| 74 |
+
let translateX = 0;
|
| 75 |
+
let translateY = 0;
|
| 76 |
+
let isDragging = false;
|
| 77 |
+
let lastMousePos = { x: 0, y: 0 };
|
| 78 |
+
|
| 79 |
+
// Initialize the app
|
| 80 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 81 |
+
updateGuidedView();
|
| 82 |
+
initializeMermaid();
|
| 83 |
+
|
| 84 |
+
// Set up mode switching
|
| 85 |
+
document.getElementById('guided-btn').addEventListener('click', () => switchMode('guided'));
|
| 86 |
+
document.getElementById('flowchart-btn').addEventListener('click', () => switchMode('flowchart'));
|
| 87 |
+
});
|
| 88 |
+
|
| 89 |
+
function switchMode(mode) {
|
| 90 |
+
const guidedMode = document.getElementById('guided-mode');
|
| 91 |
+
const flowchartMode = document.getElementById('flowchart-mode');
|
| 92 |
+
const guidedBtn = document.getElementById('guided-btn');
|
| 93 |
+
const flowchartBtn = document.getElementById('flowchart-btn');
|
| 94 |
+
|
| 95 |
+
if (mode === 'guided') {
|
| 96 |
+
guidedMode.classList.remove('hidden');
|
| 97 |
+
flowchartMode.classList.add('hidden');
|
| 98 |
+
guidedBtn.classList.add('active');
|
| 99 |
+
flowchartBtn.classList.remove('active');
|
| 100 |
+
} else {
|
| 101 |
+
guidedMode.classList.add('hidden');
|
| 102 |
+
flowchartMode.classList.remove('hidden');
|
| 103 |
+
guidedBtn.classList.remove('active');
|
| 104 |
+
flowchartBtn.classList.add('active');
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
// Guided mode functions
|
| 109 |
+
function updateGuidedView() {
|
| 110 |
+
updateContext();
|
| 111 |
+
updateHistory();
|
| 112 |
+
updateCurrentQuestion();
|
| 113 |
+
updateArticles();
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
function updateContext() {
|
| 117 |
+
const contextElement = document.querySelector('.context-text');
|
| 118 |
+
const currentData = flowchartData[currentNode];
|
| 119 |
+
contextElement.textContent = currentData.context || "You develop a GPAI model";
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
function updateHistory() {
|
| 123 |
+
const historyContainer = document.querySelector('.history-section');
|
| 124 |
+
const historyHTML = navigationHistory.map((item, index) => `
|
| 125 |
+
<div class="history-item" onclick="goToHistoryStep(${index})">
|
| 126 |
+
<div class="history-question">${truncateText(item.question, 50)}</div>
|
| 127 |
+
<div class="history-answer">→ ${item.answer}</div>
|
| 128 |
+
<div class="tooltip">${item.question}</div>
|
| 129 |
+
</div>
|
| 130 |
+
`).join('');
|
| 131 |
+
|
| 132 |
+
historyContainer.innerHTML = `
|
| 133 |
+
<h3>Decision History</h3>
|
| 134 |
+
${historyHTML}
|
| 135 |
+
`;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
function updateCurrentQuestion() {
|
| 139 |
+
const container = document.getElementById('question-container');
|
| 140 |
+
const currentData = flowchartData[currentNode];
|
| 141 |
+
|
| 142 |
+
if (currentData.type === 'question') {
|
| 143 |
+
container.innerHTML = `
|
| 144 |
+
<div class="question">${currentData.text}</div>
|
| 145 |
+
<div class="choices">
|
| 146 |
+
${currentData.choices.map(choice =>
|
| 147 |
+
`<button class="choice-btn" onclick="nextQuestion('${choice.next}', '${choice.text}')">${choice.text}</button>`
|
| 148 |
+
).join('')}
|
| 149 |
+
</div>
|
| 150 |
+
`;
|
| 151 |
+
} else {
|
| 152 |
+
// Outcome
|
| 153 |
+
let articlesHTML = '';
|
| 154 |
+
if (currentData.articles) {
|
| 155 |
+
const articlesList = currentData.articles.map(article =>
|
| 156 |
+
`<li>${article}</li>`
|
| 157 |
+
).join('');
|
| 158 |
+
|
| 159 |
+
articlesHTML = `
|
| 160 |
+
<div class="articles-section" style="margin-top: 30px;">
|
| 161 |
+
<h3>Applicable Articles</h3>
|
| 162 |
+
<ul class="articles-list">
|
| 163 |
+
${articlesList}
|
| 164 |
+
</ul>
|
| 165 |
+
</div>
|
| 166 |
+
`;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
container.innerHTML = `
|
| 170 |
+
<div class="outcome ${currentData.class || ''}">${currentData.text}</div>
|
| 171 |
+
${articlesHTML}
|
| 172 |
+
<button class="restart-btn" onclick="restart()">Start Over</button>
|
| 173 |
+
`;
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
function updateArticles() {
|
| 178 |
+
// This function is no longer needed since articles are now displayed in updateCurrentQuestion
|
| 179 |
+
// But we'll keep it empty to avoid breaking the updateGuidedView call
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function nextQuestion(nodeId, selectedChoice = null) {
|
| 183 |
+
if (selectedChoice) {
|
| 184 |
+
navigationHistory.push({
|
| 185 |
+
node: currentNode,
|
| 186 |
+
question: flowchartData[currentNode].text,
|
| 187 |
+
answer: selectedChoice,
|
| 188 |
+
nextNode: nodeId
|
| 189 |
+
});
|
| 190 |
+
}
|
| 191 |
+
currentNode = nodeId;
|
| 192 |
+
updateGuidedView();
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
function goToHistoryStep(stepIndex) {
|
| 196 |
+
navigationHistory = navigationHistory.slice(0, stepIndex);
|
| 197 |
+
currentNode = stepIndex === 0 ? 'q1' : navigationHistory[stepIndex - 1].nextNode;
|
| 198 |
+
updateGuidedView();
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
function restart() {
|
| 202 |
+
currentNode = 'q1';
|
| 203 |
+
navigationHistory = [];
|
| 204 |
+
updateGuidedView();
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
function truncateText(text, maxLength) {
|
| 208 |
+
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
// Create dynamic SVG flowchart from flowchartData
|
| 212 |
+
function initializeMermaid() {
|
| 213 |
+
const svg = generateFlowchartSVG();
|
| 214 |
+
document.getElementById('mermaid-container').innerHTML = svg;
|
| 215 |
+
setupFlowchartInteraction();
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
function generateFlowchartSVG() {
|
| 219 |
+
// Layout configuration
|
| 220 |
+
const config = {
|
| 221 |
+
startX: 200,
|
| 222 |
+
startY: 60,
|
| 223 |
+
questionSpacing: 220,
|
| 224 |
+
outcomeY: 1450, // Moved further down from 1350
|
| 225 |
+
outcomeSpacing: 350,
|
| 226 |
+
articleOffset: 70, // Reduced from 140 to bring articles closer
|
| 227 |
+
rightOutcomeX: 600,
|
| 228 |
+
diamondSize: 100
|
| 229 |
+
};
|
| 230 |
+
|
| 231 |
+
let svgContent = `<svg viewBox="0 0 1600 1600" style="width: 100%; height: auto;">`; // Increased height
|
| 232 |
+
|
| 233 |
+
// Add arrow marker definition
|
| 234 |
+
svgContent += `
|
| 235 |
+
<defs>
|
| 236 |
+
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
| 237 |
+
<polygon points="0 0, 10 3.5, 0 7" fill="#333"/>
|
| 238 |
+
</marker>
|
| 239 |
+
</defs>
|
| 240 |
+
`;
|
| 241 |
+
|
| 242 |
+
// Generate start node
|
| 243 |
+
const startY = config.startY;
|
| 244 |
+
svgContent += generateStartNode(config.startX, startY);
|
| 245 |
+
|
| 246 |
+
// Generate questions vertically
|
| 247 |
+
const questions = ['q1', 'q2', 'q3', 'q4', 'q5'];
|
| 248 |
+
questions.forEach((qId, index) => {
|
| 249 |
+
const y = startY + 60 + (index + 1) * config.questionSpacing;
|
| 250 |
+
svgContent += generateQuestion(qId, config.startX, y);
|
| 251 |
+
|
| 252 |
+
// Add connecting line from previous element
|
| 253 |
+
const prevY = index === 0 ? startY + 30 : startY + 60 + index * config.questionSpacing + config.diamondSize;
|
| 254 |
+
svgContent += `<line x1="${config.startX}" y1="${prevY}" x2="${config.startX}" y2="${y - config.diamondSize}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>`;
|
| 255 |
+
|
| 256 |
+
// Add "No" label for vertical flow (except last question)
|
| 257 |
+
if (index < questions.length - 1) {
|
| 258 |
+
svgContent += `<text x="${config.startX + 20}" y="${y + config.diamondSize + 20}" text-anchor="start" font-size="12" font-weight="bold" fill="#333">No</text>`;
|
| 259 |
+
}
|
| 260 |
+
});
|
| 261 |
+
|
| 262 |
+
// Generate outcome_research (right of q2, not q1)
|
| 263 |
+
svgContent += generateOutcome('outcome_research', config.rightOutcomeX, startY + 60 + 2 * config.questionSpacing); // Changed to Q2 position
|
| 264 |
+
svgContent += generateArticles('outcome_research', config.rightOutcomeX + config.articleOffset, startY + 60 + 2 * config.questionSpacing - 40);
|
| 265 |
+
|
| 266 |
+
// Arrow from Q1 Yes to outcome_research (curved to reach Q2 level)
|
| 267 |
+
const q1Y = startY + 60 + config.questionSpacing;
|
| 268 |
+
const q2Y = startY + 60 + 2 * config.questionSpacing;
|
| 269 |
+
svgContent += `<line x1="${config.startX + config.diamondSize}" y1="${q1Y}" x2="${config.rightOutcomeX - 150}" y2="${q1Y}" stroke="#333" stroke-width="2"/>`;
|
| 270 |
+
svgContent += `<line x1="${config.rightOutcomeX - 150}" y1="${q1Y}" x2="${config.rightOutcomeX - 150}" y2="${q2Y}" stroke="#333" stroke-width="2"/>`;
|
| 271 |
+
svgContent += `<line x1="${config.rightOutcomeX - 150}" y1="${q2Y}" x2="${config.rightOutcomeX - 60}" y2="${q2Y}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>`;
|
| 272 |
+
svgContent += `<text x="${config.startX + 140}" y="${q1Y - 5}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">Yes</text>`;
|
| 273 |
+
|
| 274 |
+
// Arrow from Q2 No to outcome_research (straight right)
|
| 275 |
+
svgContent += `<line x1="${config.startX + config.diamondSize}" y1="${q2Y}" x2="${config.rightOutcomeX - 60}" y2="${q2Y}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>`;
|
| 276 |
+
svgContent += `<text x="${config.startX + 140}" y="${q2Y - 5}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">No</text>`;
|
| 277 |
+
|
| 278 |
+
// Generate bottom row outcomes
|
| 279 |
+
const bottomOutcomes = ['outcome_open_source', 'outcome_gpai_provider_with_obligations', 'outcome_systemic_risk'];
|
| 280 |
+
bottomOutcomes.forEach((outcomeId, index) => {
|
| 281 |
+
const x = config.startX + index * config.outcomeSpacing;
|
| 282 |
+
|
| 283 |
+
// Generate outcome circle
|
| 284 |
+
svgContent += generateOutcome(outcomeId, x, config.outcomeY);
|
| 285 |
+
|
| 286 |
+
// Generate articles to the right
|
| 287 |
+
svgContent += generateArticles(outcomeId, x + config.articleOffset, config.outcomeY - 40);
|
| 288 |
+
|
| 289 |
+
// Add connecting arrows based on outcome type
|
| 290 |
+
svgContent += generateOutcomeArrow(outcomeId, x, config);
|
| 291 |
+
});
|
| 292 |
+
|
| 293 |
+
svgContent += `</svg>`;
|
| 294 |
+
return svgContent;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
function generateStartNode(x, y) {
|
| 298 |
+
return `
|
| 299 |
+
<ellipse cx="${x}" cy="${y}" rx="100" ry="30" fill="#FFA726" stroke="#FF8F00" stroke-width="3"/>
|
| 300 |
+
<text x="${x}" y="${y + 5}" text-anchor="middle" font-size="14" font-weight="bold" fill="#333">You develop a GPAI model</text>
|
| 301 |
+
`;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
function generateQuestion(questionId, x, y) {
|
| 305 |
+
const question = flowchartData[questionId];
|
| 306 |
+
if (!question) return '';
|
| 307 |
+
|
| 308 |
+
const lines = wrapText(question.text, 25);
|
| 309 |
+
const lineHeight = 15;
|
| 310 |
+
const totalHeight = lines.length * lineHeight;
|
| 311 |
+
const startY = y - totalHeight / 2 + lineHeight / 2;
|
| 312 |
+
const size = 100; // Larger diamond size
|
| 313 |
+
|
| 314 |
+
let content = `<polygon points="${x},${y-size} ${x-size},${y} ${x},${y+size} ${x+size},${y}" fill="#A5D6A7" stroke="#4CAF50" stroke-width="3"/>`;
|
| 315 |
+
|
| 316 |
+
lines.forEach((line, index) => {
|
| 317 |
+
content += `<text x="${x}" y="${startY + index * lineHeight}" text-anchor="middle" font-size="11" font-weight="bold" fill="#333">${line}</text>`;
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
return content;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
function generateOutcome(outcomeId, x, y) {
|
| 324 |
+
const outcome = flowchartData[outcomeId];
|
| 325 |
+
if (!outcome) return '';
|
| 326 |
+
|
| 327 |
+
const lines = wrapText(outcome.text, 18);
|
| 328 |
+
const lineHeight = 15;
|
| 329 |
+
const totalHeight = lines.length * lineHeight;
|
| 330 |
+
const startY = y - totalHeight / 2 + lineHeight / 2;
|
| 331 |
+
|
| 332 |
+
let content = `<circle cx="${x}" cy="${y}" r="60" fill="#333"/>`;
|
| 333 |
+
|
| 334 |
+
lines.forEach((line, index) => {
|
| 335 |
+
content += `<text x="${x}" y="${startY + index * lineHeight}" text-anchor="middle" font-size="10" fill="white" font-weight="bold">${line}</text>`;
|
| 336 |
+
});
|
| 337 |
+
|
| 338 |
+
return content;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
function generateArticles(outcomeId, x, y) {
|
| 342 |
+
const outcome = flowchartData[outcomeId];
|
| 343 |
+
if (!outcome || !outcome.articles) return '';
|
| 344 |
+
|
| 345 |
+
// Dynamic sizing based on content
|
| 346 |
+
const articleCount = outcome.articles.length;
|
| 347 |
+
const width = 180;
|
| 348 |
+
const height = Math.max(100, articleCount * 18 + 60); // Better height calculation
|
| 349 |
+
|
| 350 |
+
// Top-aligned with the outcome circle (circle is at y, radius 60, so top is y-60)
|
| 351 |
+
const adjustedY = y; // Align to top of circle instead of center
|
| 352 |
+
|
| 353 |
+
let content = `<rect x="${x}" y="${adjustedY}" width="${width}" height="${height}" fill="#E8F5E8" stroke="#4CAF50" stroke-width="3" rx="10"/>`;
|
| 354 |
+
|
| 355 |
+
// Title
|
| 356 |
+
const titleLines = wrapText(`Applicable obligations for ${getOutcomeTitle(outcomeId)}`, 22);
|
| 357 |
+
let titleY = adjustedY + 20;
|
| 358 |
+
titleLines.forEach((line, index) => {
|
| 359 |
+
content += `<text x="${x + width/2}" y="${titleY + index * 15}" text-anchor="middle" font-size="11" font-weight="bold" fill="#333">${line}</text>`;
|
| 360 |
+
});
|
| 361 |
+
|
| 362 |
+
// Articles with better spacing
|
| 363 |
+
let articleStartY = adjustedY + 20 + titleLines.length * 15 + 15;
|
| 364 |
+
outcome.articles.forEach((article, index) => {
|
| 365 |
+
const articleY = articleStartY + index * 18; // Increased spacing between articles
|
| 366 |
+
content += `<text x="${x + 15}" y="${articleY}" text-anchor="start" font-size="10" fill="#667eea">${article}</text>`;
|
| 367 |
+
});
|
| 368 |
+
|
| 369 |
+
return content;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
function generateOutcomeArrow(outcomeId, x, config) {
|
| 373 |
+
const questionY = config.startY + 60;
|
| 374 |
+
let content = '';
|
| 375 |
+
|
| 376 |
+
switch(outcomeId) {
|
| 377 |
+
case 'outcome_open_source':
|
| 378 |
+
// From Q5 No (straight down)
|
| 379 |
+
const q5Y = questionY + 5 * config.questionSpacing;
|
| 380 |
+
content = `
|
| 381 |
+
<line x1="${config.startX}" y1="${q5Y + config.diamondSize}" x2="${config.startX}" y2="${config.outcomeY - 60}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>
|
| 382 |
+
<text x="${config.startX - 30}" y="${q5Y + config.diamondSize + 40}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">No</text>
|
| 383 |
+
`;
|
| 384 |
+
break;
|
| 385 |
+
|
| 386 |
+
case 'outcome_gpai_provider_with_obligations':
|
| 387 |
+
// From Q4 No and Q5 Yes - combine to same circle
|
| 388 |
+
const q4Y = questionY + 4 * config.questionSpacing;
|
| 389 |
+
const q5Y_yes = questionY + 5 * config.questionSpacing;
|
| 390 |
+
const midPointX = x - 50; // Meeting point for both arrows
|
| 391 |
+
|
| 392 |
+
content = `
|
| 393 |
+
<!-- Q4 No path -->
|
| 394 |
+
<line x1="${config.startX + config.diamondSize}" y1="${q4Y}" x2="${midPointX}" y2="${q4Y}" stroke="#333" stroke-width="2"/>
|
| 395 |
+
<line x1="${midPointX}" y1="${q4Y}" x2="${midPointX}" y2="${config.outcomeY - 100}" stroke="#333" stroke-width="2"/>
|
| 396 |
+
<text x="${config.startX + 150}" y="${q4Y - 5}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">No</text>
|
| 397 |
+
|
| 398 |
+
<!-- Q5 Yes path -->
|
| 399 |
+
<line x1="${config.startX + config.diamondSize}" y1="${q5Y_yes}" x2="${midPointX}" y2="${q5Y_yes}" stroke="#333" stroke-width="2"/>
|
| 400 |
+
<line x1="${midPointX}" y1="${q5Y_yes}" x2="${midPointX}" y2="${config.outcomeY - 100}" stroke="#333" stroke-width="2"/>
|
| 401 |
+
<text x="${config.startX + 150}" y="${q5Y_yes - 5}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">Yes</text>
|
| 402 |
+
|
| 403 |
+
<!-- Combined path to circle -->
|
| 404 |
+
<line x1="${midPointX}" y1="${config.outcomeY - 100}" x2="${x}" y2="${config.outcomeY - 60}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>
|
| 405 |
+
`;
|
| 406 |
+
break;
|
| 407 |
+
|
| 408 |
+
case 'outcome_systemic_risk':
|
| 409 |
+
// From Q3 Yes (horizontal then down)
|
| 410 |
+
const q3Y = questionY + 3 * config.questionSpacing;
|
| 411 |
+
content = `
|
| 412 |
+
<line x1="${config.startX + config.diamondSize}" y1="${q3Y}" x2="${x}" y2="${q3Y}" stroke="#333" stroke-width="2"/>
|
| 413 |
+
<line x1="${x}" y1="${q3Y}" x2="${x}" y2="${config.outcomeY - 60}" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/>
|
| 414 |
+
<text x="${config.startX + 150}" y="${q3Y - 5}" text-anchor="middle" font-size="12" font-weight="bold" fill="#333">Yes</text>
|
| 415 |
+
`;
|
| 416 |
+
break;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
return content;
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
function getOutcomeTitle(outcomeId) {
|
| 423 |
+
switch(outcomeId) {
|
| 424 |
+
case 'outcome_research': return 'research providers';
|
| 425 |
+
case 'outcome_open_source': return 'open-source GPAI providers';
|
| 426 |
+
case 'outcome_gpai_provider_with_obligations': return 'GPAI providers';
|
| 427 |
+
case 'outcome_systemic_risk': return 'GPAISR providers';
|
| 428 |
+
default: return 'providers';
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
function wrapText(text, maxLength) {
|
| 433 |
+
const words = text.split(' ');
|
| 434 |
+
const lines = [];
|
| 435 |
+
let currentLine = '';
|
| 436 |
+
|
| 437 |
+
words.forEach(word => {
|
| 438 |
+
if ((currentLine + word).length <= maxLength) {
|
| 439 |
+
currentLine += (currentLine ? ' ' : '') + word;
|
| 440 |
+
} else {
|
| 441 |
+
if (currentLine) lines.push(currentLine);
|
| 442 |
+
currentLine = word;
|
| 443 |
+
}
|
| 444 |
+
});
|
| 445 |
+
|
| 446 |
+
if (currentLine) lines.push(currentLine);
|
| 447 |
+
return lines;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// Flowchart interaction functions (zoom, pan)
|
| 451 |
+
function updateTransform() {
|
| 452 |
+
const mermaidContainer = document.getElementById('mermaid-container');
|
| 453 |
+
if (mermaidContainer) {
|
| 454 |
+
mermaidContainer.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
|
| 455 |
+
}
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
function zoomIn() {
|
| 459 |
+
scale = Math.min(scale * 1.2, 3);
|
| 460 |
+
updateTransform();
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
function zoomOut() {
|
| 464 |
+
scale = Math.max(scale / 1.2, 0.3);
|
| 465 |
+
updateTransform();
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
function resetView() {
|
| 469 |
+
scale = 1;
|
| 470 |
+
translateX = 0;
|
| 471 |
+
translateY = 0;
|
| 472 |
+
updateTransform();
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
function setupFlowchartInteraction() {
|
| 476 |
+
const container = document.getElementById('flowchart-container');
|
| 477 |
+
if (!container) return;
|
| 478 |
+
|
| 479 |
+
// Mouse events for dragging
|
| 480 |
+
container.addEventListener('mousedown', function(e) {
|
| 481 |
+
isDragging = true;
|
| 482 |
+
lastMousePos = { x: e.clientX, y: e.clientY };
|
| 483 |
+
e.preventDefault();
|
| 484 |
+
});
|
| 485 |
+
|
| 486 |
+
document.addEventListener('mousemove', function(e) {
|
| 487 |
+
if (!isDragging) return;
|
| 488 |
+
|
| 489 |
+
const deltaX = e.clientX - lastMousePos.x;
|
| 490 |
+
const deltaY = e.clientY - lastMousePos.y;
|
| 491 |
+
|
| 492 |
+
translateX += deltaX;
|
| 493 |
+
translateY += deltaY;
|
| 494 |
+
|
| 495 |
+
updateTransform();
|
| 496 |
+
|
| 497 |
+
lastMousePos = { x: e.clientX, y: e.clientY };
|
| 498 |
+
});
|
| 499 |
+
|
| 500 |
+
document.addEventListener('mouseup', function() {
|
| 501 |
+
isDragging = false;
|
| 502 |
+
});
|
| 503 |
+
|
| 504 |
+
// Wheel zoom
|
| 505 |
+
container.addEventListener('wheel', function(e) {
|
| 506 |
+
e.preventDefault();
|
| 507 |
+
|
| 508 |
+
const rect = container.getBoundingClientRect();
|
| 509 |
+
const x = e.clientX - rect.left;
|
| 510 |
+
const y = e.clientY - rect.top;
|
| 511 |
+
|
| 512 |
+
const zoom = e.deltaY > 0 ? 0.9 : 1.1;
|
| 513 |
+
const newScale = Math.min(Math.max(scale * zoom, 0.3), 3);
|
| 514 |
+
|
| 515 |
+
const factor = newScale / scale;
|
| 516 |
+
translateX = x - (x - translateX) * factor;
|
| 517 |
+
translateY = y - (y - translateY) * factor;
|
| 518 |
+
scale = newScale;
|
| 519 |
+
|
| 520 |
+
updateTransform();
|
| 521 |
+
});
|
| 522 |
+
|
| 523 |
+
// Touch events for mobile
|
| 524 |
+
let touchStartDistance = 0;
|
| 525 |
+
let touchStartScale = 1;
|
| 526 |
+
|
| 527 |
+
container.addEventListener('touchstart', function(e) {
|
| 528 |
+
if (e.touches.length === 1) {
|
| 529 |
+
isDragging = true;
|
| 530 |
+
lastMousePos = { x: e.touches[0].clientX, y: e.touches[0].clientY };
|
| 531 |
+
} else if (e.touches.length === 2) {
|
| 532 |
+
isDragging = false;
|
| 533 |
+
const touch1 = e.touches[0];
|
| 534 |
+
const touch2 = e.touches[1];
|
| 535 |
+
touchStartDistance = Math.sqrt(
|
| 536 |
+
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
| 537 |
+
Math.pow(touch2.clientY - touch1.clientY, 2)
|
| 538 |
+
);
|
| 539 |
+
touchStartScale = scale;
|
| 540 |
+
}
|
| 541 |
+
e.preventDefault();
|
| 542 |
+
});
|
| 543 |
+
|
| 544 |
+
container.addEventListener('touchmove', function(e) {
|
| 545 |
+
if (e.touches.length === 1 && isDragging) {
|
| 546 |
+
const deltaX = e.touches[0].clientX - lastMousePos.x;
|
| 547 |
+
const deltaY = e.touches[0].clientY - lastMousePos.y;
|
| 548 |
+
|
| 549 |
+
translateX += deltaX;
|
| 550 |
+
translateY += deltaY;
|
| 551 |
+
|
| 552 |
+
updateTransform();
|
| 553 |
+
|
| 554 |
+
lastMousePos = { x: e.touches[0].clientX, y: e.touches[0].clientY };
|
| 555 |
+
} else if (e.touches.length === 2) {
|
| 556 |
+
const touch1 = e.touches[0];
|
| 557 |
+
const touch2 = e.touches[1];
|
| 558 |
+
const currentDistance = Math.sqrt(
|
| 559 |
+
Math.pow(touch2.clientX - touch1.clientX, 2) +
|
| 560 |
+
Math.pow(touch2.clientY - touch1.clientY, 2)
|
| 561 |
+
);
|
| 562 |
+
|
| 563 |
+
scale = Math.min(Math.max(touchStartScale * (currentDistance / touchStartDistance), 0.3), 3);
|
| 564 |
+
updateTransform();
|
| 565 |
+
}
|
| 566 |
+
e.preventDefault();
|
| 567 |
+
});
|
| 568 |
+
|
| 569 |
+
container.addEventListener('touchend', function(e) {
|
| 570 |
+
isDragging = false;
|
| 571 |
+
e.preventDefault();
|
| 572 |
+
});
|
| 573 |
+
}
|
styles.css
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
* {
|
| 2 |
+
margin: 0;
|
| 3 |
+
padding: 0;
|
| 4 |
+
box-sizing: border-box;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
body {
|
| 8 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 9 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 10 |
+
min-height: 100vh;
|
| 11 |
+
color: #333;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
.container {
|
| 15 |
+
max-width: 1200px;
|
| 16 |
+
margin: 0 auto;
|
| 17 |
+
padding: 20px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
header {
|
| 21 |
+
text-align: center;
|
| 22 |
+
margin-bottom: 30px;
|
| 23 |
+
color: white;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
h1 {
|
| 27 |
+
font-size: 2.5em;
|
| 28 |
+
margin-bottom: 10px;
|
| 29 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.subtitle {
|
| 33 |
+
font-size: 1.2em;
|
| 34 |
+
opacity: 0.9;
|
| 35 |
+
margin-bottom: 30px;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.mode-selector {
|
| 39 |
+
display: flex;
|
| 40 |
+
justify-content: center;
|
| 41 |
+
gap: 20px;
|
| 42 |
+
margin-bottom: 30px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.mode-btn {
|
| 46 |
+
background: rgba(255, 255, 255, 0.9);
|
| 47 |
+
border: none;
|
| 48 |
+
padding: 15px 30px;
|
| 49 |
+
border-radius: 25px;
|
| 50 |
+
font-size: 1.1em;
|
| 51 |
+
font-weight: bold;
|
| 52 |
+
cursor: pointer;
|
| 53 |
+
transition: all 0.3s ease;
|
| 54 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.mode-btn:hover {
|
| 58 |
+
background: white;
|
| 59 |
+
transform: translateY(-2px);
|
| 60 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.2);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.mode-btn.active {
|
| 64 |
+
background: #4CAF50;
|
| 65 |
+
color: white;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.content {
|
| 69 |
+
background: white;
|
| 70 |
+
border-radius: 15px;
|
| 71 |
+
min-height: 600px;
|
| 72 |
+
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
| 73 |
+
overflow: hidden;
|
| 74 |
+
position: relative;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.guided-mode, .flowchart-mode {
|
| 78 |
+
padding: 0;
|
| 79 |
+
height: 100%;
|
| 80 |
+
min-height: 600px;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.guided-mode {
|
| 84 |
+
display: flex;
|
| 85 |
+
height: 600px;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.navigation-panel {
|
| 89 |
+
width: 300px;
|
| 90 |
+
background: #f8f9fa;
|
| 91 |
+
border-right: 1px solid #e9ecef;
|
| 92 |
+
padding: 20px;
|
| 93 |
+
overflow-y: auto;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.current-panel {
|
| 97 |
+
flex: 1;
|
| 98 |
+
padding: 30px;
|
| 99 |
+
display: flex;
|
| 100 |
+
flex-direction: column;
|
| 101 |
+
justify-content: center;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.context-section {
|
| 105 |
+
margin-bottom: 20px;
|
| 106 |
+
padding: 15px;
|
| 107 |
+
background: #e3f2fd;
|
| 108 |
+
border-radius: 8px;
|
| 109 |
+
border-left: 4px solid #2196f3;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.context-section h3 {
|
| 113 |
+
color: #1976d2;
|
| 114 |
+
margin-bottom: 10px;
|
| 115 |
+
font-size: 1.1em;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.context-text {
|
| 119 |
+
color: #424242;
|
| 120 |
+
font-weight: 500;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.history-section {
|
| 124 |
+
margin-bottom: 20px;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.history-section h3 {
|
| 128 |
+
color: #333;
|
| 129 |
+
margin-bottom: 15px;
|
| 130 |
+
font-size: 1.1em;
|
| 131 |
+
border-bottom: 2px solid #ddd;
|
| 132 |
+
padding-bottom: 5px;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.history-item {
|
| 136 |
+
margin-bottom: 10px;
|
| 137 |
+
padding: 10px;
|
| 138 |
+
background: white;
|
| 139 |
+
border-radius: 6px;
|
| 140 |
+
border: 1px solid #ddd;
|
| 141 |
+
cursor: pointer;
|
| 142 |
+
transition: all 0.2s ease;
|
| 143 |
+
position: relative;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.history-item:hover {
|
| 147 |
+
background: #f0f7ff;
|
| 148 |
+
border-color: #2196f3;
|
| 149 |
+
transform: translateX(5px);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.history-question {
|
| 153 |
+
font-weight: bold;
|
| 154 |
+
color: #333;
|
| 155 |
+
margin-bottom: 5px;
|
| 156 |
+
font-size: 0.9em;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.history-answer {
|
| 160 |
+
color: #666;
|
| 161 |
+
font-style: italic;
|
| 162 |
+
font-size: 0.85em;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.tooltip {
|
| 166 |
+
position: absolute;
|
| 167 |
+
left: 100%;
|
| 168 |
+
top: 0;
|
| 169 |
+
margin-left: 10px;
|
| 170 |
+
background: #333;
|
| 171 |
+
color: white;
|
| 172 |
+
padding: 8px 12px;
|
| 173 |
+
border-radius: 4px;
|
| 174 |
+
font-size: 0.8em;
|
| 175 |
+
white-space: nowrap;
|
| 176 |
+
opacity: 0;
|
| 177 |
+
pointer-events: none;
|
| 178 |
+
transition: opacity 0.2s ease;
|
| 179 |
+
z-index: 1000;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.history-item:hover .tooltip {
|
| 183 |
+
opacity: 1;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.tooltip::before {
|
| 187 |
+
content: '';
|
| 188 |
+
position: absolute;
|
| 189 |
+
left: -5px;
|
| 190 |
+
top: 50%;
|
| 191 |
+
transform: translateY(-50%);
|
| 192 |
+
border: 5px solid transparent;
|
| 193 |
+
border-right-color: #333;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.articles-section {
|
| 197 |
+
padding: 15px;
|
| 198 |
+
background: #e8f5e8;
|
| 199 |
+
border-radius: 8px;
|
| 200 |
+
border-left: 4px solid #4caf50;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
.articles-section h3 {
|
| 204 |
+
color: #2e7d32;
|
| 205 |
+
margin-bottom: 10px;
|
| 206 |
+
font-size: 1.1em;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.articles-list {
|
| 210 |
+
list-style: none;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
.articles-list li {
|
| 214 |
+
margin-bottom: 5px;
|
| 215 |
+
padding: 5px;
|
| 216 |
+
background: white;
|
| 217 |
+
border-radius: 4px;
|
| 218 |
+
font-size: 0.9em;
|
| 219 |
+
color: #1565c0;
|
| 220 |
+
cursor: pointer;
|
| 221 |
+
transition: background 0.2s ease;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.articles-list li:hover {
|
| 225 |
+
background: #e3f2fd;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
#question-container {
|
| 229 |
+
text-align: center;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.question {
|
| 233 |
+
font-size: 1.8em;
|
| 234 |
+
margin-bottom: 30px;
|
| 235 |
+
color: #333;
|
| 236 |
+
line-height: 1.4;
|
| 237 |
+
font-weight: 500;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.choices {
|
| 241 |
+
display: flex;
|
| 242 |
+
gap: 20px;
|
| 243 |
+
justify-content: center;
|
| 244 |
+
flex-wrap: wrap;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
.choice-btn {
|
| 248 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 249 |
+
color: white;
|
| 250 |
+
border: none;
|
| 251 |
+
padding: 15px 30px;
|
| 252 |
+
border-radius: 25px;
|
| 253 |
+
font-size: 1.1em;
|
| 254 |
+
font-weight: bold;
|
| 255 |
+
cursor: pointer;
|
| 256 |
+
transition: all 0.3s ease;
|
| 257 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 258 |
+
min-width: 120px;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
.choice-btn:hover {
|
| 262 |
+
transform: translateY(-2px);
|
| 263 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.2);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
.outcome {
|
| 267 |
+
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
|
| 268 |
+
color: #155724;
|
| 269 |
+
padding: 30px;
|
| 270 |
+
border-radius: 15px;
|
| 271 |
+
margin-top: 20px;
|
| 272 |
+
font-size: 1.2em;
|
| 273 |
+
line-height: 1.6;
|
| 274 |
+
border: 2px solid #4CAF50;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
.outcome.gpai {
|
| 278 |
+
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
|
| 279 |
+
color: #155724;
|
| 280 |
+
border: 2px solid #4CAF50;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.breadcrumb {
|
| 284 |
+
margin-bottom: 20px;
|
| 285 |
+
font-size: 0.9em;
|
| 286 |
+
color: #666;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.breadcrumb span {
|
| 290 |
+
margin: 0 5px;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.restart-btn {
|
| 294 |
+
background: #f44336;
|
| 295 |
+
color: white;
|
| 296 |
+
border: none;
|
| 297 |
+
padding: 10px 20px;
|
| 298 |
+
border-radius: 20px;
|
| 299 |
+
cursor: pointer;
|
| 300 |
+
font-size: 0.9em;
|
| 301 |
+
margin-top: 20px;
|
| 302 |
+
transition: background 0.3s ease;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.restart-btn:hover {
|
| 306 |
+
background: #d32f2f;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
.flowchart-mode {
|
| 310 |
+
position: relative;
|
| 311 |
+
overflow: hidden;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
.controls {
|
| 315 |
+
position: absolute;
|
| 316 |
+
top: 20px;
|
| 317 |
+
right: 20px;
|
| 318 |
+
display: flex;
|
| 319 |
+
gap: 10px;
|
| 320 |
+
z-index: 100;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
.control-btn {
|
| 324 |
+
background: white;
|
| 325 |
+
border: 2px solid #ddd;
|
| 326 |
+
width: 40px;
|
| 327 |
+
height: 40px;
|
| 328 |
+
border-radius: 50%;
|
| 329 |
+
font-size: 18px;
|
| 330 |
+
font-weight: bold;
|
| 331 |
+
cursor: pointer;
|
| 332 |
+
display: flex;
|
| 333 |
+
align-items: center;
|
| 334 |
+
justify-content: center;
|
| 335 |
+
transition: all 0.2s ease;
|
| 336 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
.control-btn:hover {
|
| 340 |
+
background: #f0f0f0;
|
| 341 |
+
border-color: #999;
|
| 342 |
+
transform: scale(1.05);
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
.flowchart-container {
|
| 346 |
+
width: 100%;
|
| 347 |
+
height: 600px;
|
| 348 |
+
overflow: hidden;
|
| 349 |
+
cursor: grab;
|
| 350 |
+
position: relative;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
.flowchart-container:active {
|
| 354 |
+
cursor: grabbing;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
#mermaid-container {
|
| 358 |
+
transform-origin: 0 0;
|
| 359 |
+
transition: transform 0.3s ease;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
.hidden {
|
| 363 |
+
display: none;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
/* Mobile Responsiveness */
|
| 367 |
+
@media (max-width: 768px) {
|
| 368 |
+
.container {
|
| 369 |
+
padding: 10px;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
h1 {
|
| 373 |
+
font-size: 2em;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
.mode-selector {
|
| 377 |
+
flex-direction: column;
|
| 378 |
+
align-items: center;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
.guided-mode {
|
| 382 |
+
flex-direction: column;
|
| 383 |
+
height: auto;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
.navigation-panel {
|
| 387 |
+
width: 100%;
|
| 388 |
+
max-height: 300px;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
.current-panel {
|
| 392 |
+
padding: 20px;
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
.question {
|
| 396 |
+
font-size: 1.4em;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
.choices {
|
| 400 |
+
flex-direction: column;
|
| 401 |
+
align-items: center;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
.choice-btn {
|
| 405 |
+
width: 100%;
|
| 406 |
+
max-width: 300px;
|
| 407 |
+
}
|
| 408 |
+
}
|