.rome-bs-container {
max-width: 800px;
margin: 0 auto;
background: #1c1512;
border: 3px solid #c5a059;
border-radius: 8px;
padding: 16px;
font-family: 'Georgia', serif;
color: #f4e8c1;
box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.rome-bs-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 12px;
border-bottom: 2px solid #c5a059;
margin-bottom: 16px;
}
.rome-bs-title {
font-size: 16px;
font-weight: bold;
color: #f0c967;
letter-spacing: 1px;
}
.rome-bs-stats {
display: flex;
gap: 16px;
font-size: 14px;
color: #75b780;
}
.rome-bs-body {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.rome-bs-grid-section {
flex: 1 1 320px;
display: flex;
justify-content: center;
}
.rome-bs-grid {
display: grid;
grid-template-columns: repeat(10, 1fr);
gap: 3px;
background: #1a3244;
padding: 8px;
border-radius: 6px;
border: 2px solid #c5a059;
user-select: none;
}
.rome-bs-cell {
aspect-ratio: 1;
width: 30px;
background: #254b68;
border: 1px solid #36648b;
border-radius: 3px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-size: 14px;
transition: background 0.2s;
}
.rome-bs-cell:hover { background: #35668d; }
.rome-bs-cell.miss { background: #162633; color: #5a7d9a; cursor: default; }
.rome-bs-cell.hit { background: #962d2d; color: #ffeb3b; font-weight: bold; cursor: default; animation: pop 0.3s; }
.rome-bs-sidebar {
flex: 1 1 220px;
background: #2b1d16;
padding: 12px;
border-radius: 6px;
border: 1px solid #7a5a46;
display: flex;
flex-direction: column;
gap: 10px;
}
.rome-bs-sidebar-title {
font-size: 13px;
font-weight: bold;
color: #f0c967;
border-bottom: 1px solid #5a4031;
padding-bottom: 4px;
}
.rome-bs-fleet-list {
display: flex;
flex-direction: column;
gap: 6px;
}
.rome-bs-ship-item {
display: flex;
justify-content: space-between;
font-size: 12px;
background: #3d2b21;
padding: 6px 8px;
border-radius: 4px;
}
.rome-bs-ship-item.sunk { text-decoration: line-through; opacity: 0.5; background: #5c2020; }
.rome-bs-log {
margin-top: auto;
font-size: 12px;
color: #c5a059;
font-style: italic;
min-height: 36px;
}
.rome-bs-modal {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.85);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: 16px;
}
.rome-bs-modal-card {
background: #2b1d16;
border: 2px solid #c5a059;
border-radius: 8px;
max-width: 480px;
width: 100%;
padding: 16px;
box-shadow: 0 4px 25px rgba(0,0,0,0.8);
}
.rome-bs-modal-header {
font-size: 14px;
font-weight: bold;
color: #f0c967;
border-bottom: 1px solid #5a4031;
padding-bottom: 6px;
margin-bottom: 12px;
}
#bs-quiz-q { font-size: 14px; margin-bottom: 12px; line-height: 1.4; }
.rome-bs-opts-grid { display: flex; flex-direction: column; gap: 8px; }
.rome-bs-opt-btn {
background: #3d2b21;
border: 1px solid #7a5a46;
color: #f4e8c1;
padding: 8px 12px;
border-radius: 4px;
font-size: 13px;
cursor: pointer;
text-align: left;
}
.rome-bs-opt-btn:hover { background: #573e30; border-color: #c5a059; }
@keyframes pop { 0% { transform: scale(0.8); } 100% { transform: scale(1); } }
(function() {
const questions = [
{ q: "Who were the wealthy land-owning upper class in Rome?", opts: ["Plebeians", "Patricians", "Equites", "Auxiliaries"], ans: 1 },
{ q: "What was a domus in Ancient Rome?", opts: ["Apartment block", "Private townhouse", "Public bath", "Marketplace"], ans: 1 },
{ q: "Which underfloor heating system was invented by Romans?", opts: ["Hypocaust", "Aqueduct", "Catacomb", "Atrium"], ans: 0 },
{ q: "Where were chariot races held for 150,000 spectators?", opts: ["Colosseum", "Circus Maximus", "Forum", "Pantheon"], ans: 1 },
{ q: "What shield formed the protective 'Testudo' formation?", opts: ["Scutum", "Pilum", "Gladius", "Lorica"], ans: 0 },
{ q: "What was a common punishment for major crimes in Rome?", opts: ["Exile", "Promotional rank", "Free villa", "Senator title"], ans: 0 },
{ q: "What were underground burial tunnels outside Rome called?", opts: ["Aqueducts", "Catacombs", "Atriums", "Forums"], ans: 1 },
{ q: "Which famous Roman city was buried by Mount Vesuvius in 79 AD?", opts: ["Herculaneum", "Ostia", "Pompeii", "Carthage"], ans: 2 },
{ q: "What system carried fresh water from distant mountain springs?", opts: ["Aqueducts", "Viaducts", "Cloaca Maxima", "Hypocausts"], ans: 0 },
{ q: "What was the traditional woolen garment worn by male citizens?", opts: ["Stola", "Toga", "Tunica", "Chlamys"], ans: 1 },
{ q: "What garment was traditionally worn by married Roman women?", opts: ["Stola", "Toga", "Peplos", "Cena"], ans: 0 },
{ q: "What was the main evening meal in Ancient Rome called?", opts: ["Prandium", "Cena", "Ientaculum", "Thermae"], ans: 1 },
{ q: "What were Ancient Roman fast-food counter shops called?", opts: ["Thermopolia", "Forum", "Insulae", "Atrium"], ans: 0 },
{ q: "What was the belief in multiple gods (Jupiter, Mars, etc.)?", opts: ["Monotheism", "Polytheism", "Atheism", "Deism"], ans: 1 },
{ q: "Who was the Roman general appointed Dictator for Life in 44 BC?", opts: ["Augustus", "Julius Caesar", "Nero", "Trajan"], ans: 1 }
];
const ships = [
{ name: "Decere flagship", size: 5, hits: 0 },
{ name: "Quinquereme", size: 4, hits: 0 },
{ name: "Trireme", size: 3, hits: 0 },
{ name: "Liburnian", size: 3, hits: 0 },
{ name: "Scout Galley", size: 2, hits: 0 }
];
const gridSize = 10;
const board = Array(gridSize).fill(null).map(() => Array(gridSize).fill(null));
let totalHits = 0;
let shots = 0;
let pendingHitCell = null;
let currentQIndex = 0;
// Sound Engine
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function playSound(freq, type, duration) {
if (audioCtx.state === 'suspended') audioCtx.resume();
const osc = audioCtx.createOscillator();
const gain = audioCtx.createGain();
osc.type = type;
osc.frequency.value = freq;
gain.gain.setValueAtTime(0.15, audioCtx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, audioCtx.currentTime + duration);
osc.connect(gain);
gain.connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + duration);
}
// Random Ship Placement
ships.forEach((ship, shipIdx) => {
let placed = false;
while (!placed) {
const dir = Math.random() > 0.5 ? 'H' : 'V';
const r = Math.floor(Math.random() * (gridSize - (dir === 'V' ? ship.size : 0)));
const c = Math.floor(Math.random() * (gridSize - (dir === 'H' ? ship.size : 0)));
let clear = true;
for (let i = 0; i < ship.size; i++) {
if (board[r + (dir === 'V' ? i : 0)][c + (dir === 'H' ? i : 0)] !== null) {
clear = false; break;
}
}
if (clear) {
for (let i = 0; i < ship.size; i++) {
board[r + (dir === 'V' ? i : 0)][c + (dir === 'H' ? i : 0)] = shipIdx;
}
placed = true;
}
}
});
// Render Grid
const gridEl = document.getElementById('romeBsGrid');
const cells = {};
for (let r = 0; r < gridSize; r++) {
for (let c = 0; c fireShot(r, c);
gridEl.appendChild(cell);
cells[`${r},${c}`] = cell;
}
}
// Render Fleet List
const fleetEl = document.getElementById('romeBsFleet');
ships.forEach((ship, idx) => {
const item = document.createElement('div');
item.className = 'rome-bs-ship-item';
item.id = `ship-item-${idx}`;
item.innerHTML = `
${ship.name} ${'⚔️'.repeat(ship.size)}`;
fleetEl.appendChild(item);
});
function fireShot(r, c) {
const cell = cells[`${r},${c}`];
if (cell.classList.contains('hit') || cell.classList.contains('miss')) return;
shots++;
document.getElementById('bs-shots').innerText = shots;
const shipIdx = board[r][c];
if (shipIdx !== null) {
pendingHitCell = { r, c, shipIdx };
openQuiz();
} else {
cell.classList.add('miss');
cell.innerText = '💧';
playSound(180, 'sine', 0.2);
document.getElementById('romeBsLog').innerText = "Splash! Catapult boulder landed in open waters.";
}
}
function openQuiz() {
const q = questions[currentQIndex % questions.length];
currentQIndex++;
document.getElementById('bs-quiz-q').innerText = q.q;
const optsEl = document.getElementById('bs-quiz-opts');
optsEl.innerHTML = '';
q.opts.forEach((opt, idx) => {
const btn = document.createElement('button');
btn.className = 'rome-bs-opt-btn';
btn.innerText = opt;
btn.onclick = () => resolveQuiz(idx === q.ans);
optsEl.appendChild(btn);
});
document.getElementById('bs-quiz-modal').style.display = 'flex';
}
function resolveQuiz(correct) {
document.getElementById('bs-quiz-modal').style.display = 'none';
const { r, c, shipIdx } = pendingHitCell;
const cell = cells[`${r},${c}`];
if (correct) {
cell.classList.add('hit');
cell.innerText = '💥';
playSound(440, 'triangle', 0.4);
totalHits++;
document.getElementById('bs-hits').innerText = totalHits;
const ship = ships[shipIdx];
ship.hits++;
if (ship.hits === ship.size) {
document.getElementById(`ship-item-${shipIdx}`).classList.add('sunk');
document.getElementById('romeBsLog').innerText = `🔥 VICTORY! You sank the Roman ${ship.name}!`;
} else {
document.getElementById('romeBsLog').innerText = `💥 Strike confirmed! Direct catapult hit on ${ship.name}!`;
}
if (totalHits === 17) {
document.getElementById('romeBsLog').innerText = "🏆 GLORY TO ROME! You destroyed the entire enemy fleet!";
}
} else {
document.getElementById('romeBsLog').innerText = "🛡️ Strike missed! The catapult failed due to incorrect target calculation.";
cell.classList.add('miss');
cell.innerText = '❌';
}
}
})();