/* ===== CURSOR TAROT/ORACLE SYSTEM ===== */
.tarot-panel {
background: rgba(30, 30, 50, 0.5);
border-radius: 8px;
padding: 15px;
margin-top: 10px;
}
.tarot-panel h3 {
color: #b19cd9;
font-size: 0.85em;
margin-bottom: 12px;
text-transform: uppercase;
letter-spacing: 1px;
text-align: center;
}
.tarot-draw-btn {
width: 100%;
padding: 12px;
background: linear-gradient(135deg, #b19cd9, #9370db);
border: none;
color: #0a0a0f;
border-radius: 6px;
cursor: pointer;
font-family: inherit;
font-size: 0.9em;
font-weight: bold;
transition: all 0.2s;
margin-bottom: 10px;
}
.tarot-draw-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(177, 156, 217, 0.4);
}
.tarot-draw-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.tarot-mode-selector {
display: flex;
gap: 5px;
margin-bottom: 12px;
}
.tarot-mode-btn {
flex: 1;
padding: 6px;
background: rgba(177, 156, 217, 0.1);
border: 1px solid rgba(177, 156, 217, 0.3);
border-radius: 4px;
color: #b19cd9;
cursor: pointer;
font-size: 0.75em;
transition: all 0.2s;
}
.tarot-mode-btn.active {
background: linear-gradient(135deg, #b19cd9, #9370db);
color: #0a0a0f;
font-weight: bold;
}
.tarot-spread {
display: flex;
justify-content: space-between;
gap: 8px;
margin: 15px 0;
min-height: 140px;
}
.tarot-card {
flex: 1;
background: linear-gradient(135deg, #1a1a2e, #2a2a3e);
border: 2px solid rgba(177, 156, 217, 0.4);
border-radius: 8px;
padding: 8px;
position: relative;
transition: all 0.3s ease;
cursor: pointer;
overflow: hidden;
}
.tarot-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg,
rgba(177, 156, 217, 0.1) 0%,
rgba(147, 112, 219, 0.1) 100%);
opacity: 0;
transition: opacity 0.3s;
}
.tarot-card:hover::before {
opacity: 1;
}
.tarot-card.reversed {
transform: rotate(180deg);
}
.tarot-card.revealing {
animation: cardReveal 0.6s ease-out;
}
@keyframes cardReveal {
0% { transform: rotateY(90deg); opacity: 0; }
100% { transform: rotateY(0deg); opacity: 1; }
}
.tarot-card-symbol {
font-size: 2em;
text-align: center;
margin: 8px 0;
}
.tarot-card-name {
font-size: 0.7em;
text-align: center;
color: #b19cd9;
font-weight: bold;
margin-bottom: 4px;
line-height: 1.2;
}
.tarot-card-position {
font-size: 0.65em;
text-align: center;
color: #888;
font-style: italic;
}
.tarot-interpretation {
background: rgba(0, 0, 0, 0.4);
border: 1px solid rgba(177, 156, 217, 0.3);
border-radius: 6px;
padding: 12px;
margin-top: 10px;
font-size: 0.8em;
line-height: 1.5;
color: #d0d0d0;
}
.tarot-interpretation-header {
color: #b19cd9;
font-weight: bold;
margin-bottom: 8px;
text-align: center;
}
.tarot-daily-card {
background: rgba(177, 156, 217, 0.1);
border: 1px solid rgba(177, 156, 217, 0.3);
border-radius: 6px;
padding: 10px;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 10px;
}
.tarot-daily-symbol {
font-size: 2em;
filter: drop-shadow(0 0 8px rgba(177, 156, 217, 0.5));
}
.tarot-daily-info {
flex: 1;
}
.tarot-daily-title {
font-size: 0.75em;
color: #888;
margin-bottom: 2px;
}
.tarot-daily-name {
font-size: 0.85em;
color: #b19cd9;
font-weight: bold;
}
.tarot-stats {
margin-top: 12px;
}
.tarot-stat-row {
display: flex;
justify-content: space-between;
margin-bottom: 6px;
font-size: 0.8em;
}
.tarot-stat-label {
color: #888;
}
.tarot-stat-value {
color: #b19cd9;
font-weight: bold;
}
.tarot-history {
max-height: 150px;
overflow-y: auto;
margin-top: 10px;
border: 1px solid rgba(177, 156, 217, 0.2);
border-radius: 4px;
padding: 8px;
background: rgba(0, 0, 0, 0.3);
}
.tarot-history-entry {
font-size: 0.75em;
padding: 6px;
margin-bottom: 4px;
background: rgba(177, 156, 217, 0.05);
border-radius: 4px;
border-left: 3px solid #b19cd9;
}
.tarot-history-date {
color: #888;
font-size: 0.9em;
}
.tarot-history-cards {
color: #d0d0d0;
margin-top: 3px;
}
.tarot-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.9);
z-index: 3000;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
pointer-events: none;
transition: opacity 0.4s;
}
.tarot-overlay.visible {
opacity: 1;
pointer-events: all;
}
.tarot-reading-display {
background: linear-gradient(135deg, #1a1a2e, #2a2a3e);
border: 3px solid #b19cd9;
border-radius: 15px;
padding: 30px;
max-width: 600px;
width: 90%;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 0 100px rgba(177, 156, 217, 0.6);
}
.tarot-reading-header {
text-align: center;
margin-bottom: 25px;
}
.tarot-reading-title {
color: #b19cd9;
font-size: 1.4em;
font-weight: bold;
margin-bottom: 8px;
}
.tarot-reading-subtitle {
color: #888;
font-size: 0.9em;
font-style: italic;
}
.tarot-reading-cards {
display: flex;
justify-content: center;
gap: 15px;
margin: 25px 0;
flex-wrap: wrap;
}
.tarot-reading-card {
flex: 1;
max-width: 150px;
min-width: 120px;
}
.tarot-reading-card-inner {
background: linear-gradient(135deg, #2a2a3e, #3a3a4e);
border: 2px solid #b19cd9;
border-radius: 10px;
padding: 15px 10px;
text-align: center;
position: relative;
min-height: 180px;
display: flex;
flex-direction: column;
justify-content: center;
}
.tarot-reading-prophecy {
background: rgba(177, 156, 217, 0.1);
border-left: 3px solid #b19cd9;
padding: 15px;
margin: 20px 0;
border-radius: 4px;
font-style: italic;
color: #d4af37;
line-height: 1.6;
}
.tarot-close-btn {
width: 100%;
padding: 12px;
background: rgba(177, 156, 217, 0.2);
border: 1px solid rgba(177, 156, 217, 0.4);
color: #b19cd9;
border-radius: 6px;
cursor: pointer;
font-family: inherit;
font-size: 0.9em;
transition: all 0.2s;
margin-top: 20px;
}
.tarot-close-btn:hover {
background: rgba(177, 156, 217, 0.3);
}
.rune-cast {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
margin: 15px 0;
}
.rune-stone {
background: linear-gradient(135deg, #4a4a5a, #2a2a3a);
border: 2px solid rgba(177, 156, 217, 0.4);
border-radius: 50%;
aspect-ratio: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 1.5em;
cursor: pointer;
transition: all 0.3s;
position: relative;
}
.rune-stone:hover {
transform: scale(1.05);
border-color: #b19cd9;
box-shadow: 0 0 15px rgba(177, 156, 217, 0.4);
}
.rune-name {
font-size: 0.4em;
color: #b19cd9;
margin-top: 4px;
}
.hexagram-display {
background: linear-gradient(135deg, #1a1a2e, #2a2a3e);
border: 2px solid rgba(177, 156, 217, 0.4);
border-radius: 8px;
padding: 15px;
margin: 15px 0;
display: flex;
gap: 15px;
align-items: center;
}
.hexagram-lines {
font-family: 'Courier New', monospace;
font-size: 1.4em;
line-height: 1.2;
color: #b19cd9;
text-align: center;
}
.hexagram-info {
flex: 1;
}
.hexagram-number {
color: #888;
font-size: 0.8em;
margin-bottom: 4px;
}
.hexagram-name {
color: #b19cd9;
font-size: 1em;
font-weight: bold;
margin-bottom: 4px;
}
.hexagram-meaning {
color: #d0d0d0;
font-size: 0.8em;
font-style: italic;
}
🔮 Cursor Tarot & Oracle
🌟
Card of the Session
The Fool
Total Readings:
0
Prediction Accuracy:
—
Fate Alignment:
Neutral
The cards reveal your path...
// ===== CURSOR TAROT/ORACLE SYSTEM =====
const MAJOR_ARCANA = [
{ name: 'The Fool', symbol: '🃏', meaning: 'New beginnings, spontaneity, exploration', reversed: 'Recklessness, fear of unknown' },
{ name: 'The Magician', symbol: '🎩', meaning: 'Manifestation, resourcefulness, power', reversed: 'Manipulation, poor planning' },
{ name: 'The High Priestess', symbol: '🌙', meaning: 'Intuition, sacred knowledge, subconscious', reversed: 'Secrets, disconnection from intuition' },
{ name: 'The Empress', symbol: '👑', meaning: 'Femininity, beauty, nature, abundance', reversed: 'Creative block, dependence' },
{ name: 'The Emperor', symbol: '⚔️', meaning: 'Authority, structure, control', reversed: 'Domination, excessive control' },
{ name: 'The Hierophant', symbol: '📿', meaning: 'Spiritual wisdom, conformity, tradition', reversed: 'Rebellion, subversiveness' },
{ name: 'The Lovers', symbol: '💕', meaning: 'Love, harmony, relationships, choices', reversed: 'Disharmony, imbalance' },
{ name: 'The Chariot', symbol: '🏇', meaning: 'Control, willpower, victory, determination', reversed: 'Lack of direction, opposition' },
{ name: 'Strength', symbol: '🦁', meaning: 'Courage, patience, compassion', reversed: 'Self-doubt, weakness' },
{ name: 'The Hermit', symbol: '🕯️', meaning: 'Soul searching, introspection, inner guidance', reversed: 'Isolation, loneliness' },
{ name: 'Wheel of Fortune', symbol: '☸️', meaning: 'Good luck, karma, life cycles', reversed: 'Bad luck, resistance to change' },
{ name: 'Justice', symbol: '⚖️', meaning: 'Justice, fairness, truth, law', reversed: 'Unfairness, lack of accountability' },
{ name: 'The Hanged Man', symbol: '🙃', meaning: 'Pause, surrender, letting go', reversed: 'Delays, resistance' },
{ name: 'Death', symbol: '💀', meaning: 'Endings, beginnings, change, transformation', reversed: 'Resistance to change, stagnation' },
{ name: 'Temperance', symbol: '🍵', meaning: 'Balance, moderation, patience', reversed: 'Imbalance, excess' },
{ name: 'The Devil', symbol: '😈', meaning: 'Shadow self, attachment, addiction', reversed: 'Releasing limiting beliefs, freedom' },
{ name: 'The Tower', symbol: '🗼', meaning: 'Sudden change, upheaval, revelation', reversed: 'Personal transformation, avoiding disaster' },
{ name: 'The Star', symbol: '⭐', meaning: 'Hope, faith, purpose, renewal', reversed: 'Lack of faith, despair' },
{ name: 'The Moon', symbol: '🌕', meaning: 'Illusion, fear, anxiety, subconscious', reversed: 'Release of fear, clarity' },
{ name: 'The Sun', symbol: '☀️', meaning: 'Positivity, fun, warmth, success', reversed: 'Inner child, overly optimistic' },
{ name: 'Judgement', symbol: '📯', meaning: 'Judgement, rebirth, inner calling', reversed: 'Self-doubt, refusal of self-examination' },
{ name: 'The World', symbol: '🌍', meaning: 'Completion, accomplishment, travel', reversed: 'Incompletion, no closure' }
];
const ELDER_FUTHARK = [
{ name: 'Fehu', symbol: 'ᚠ', meaning: 'Wealth, abundance, success', element: 'fire' },
{ name: 'Uruz', symbol: 'ᚢ', meaning: 'Strength, health, vitality', element: 'earth' },
{ name: 'Thurisaz', symbol: 'ᚦ', meaning: 'Gateway, protection, conflict', element: 'fire' },
{ name: 'Ansuz', symbol: 'ᚨ', meaning: 'Communication, wisdom, revelation', element: 'air' },
{ name: 'Raidho', symbol: 'ᚱ', meaning: 'Journey, evolution, movement', element: 'air' },
{ name: 'Kenaz', symbol: 'ᚲ', meaning: 'Vision, creativity, inspiration', element: 'fire' },
{ name: 'Gebo', symbol: 'ᚷ', meaning: 'Gift, partnership, balance', element: 'air' },
{ name: 'Wunjo', symbol: 'ᚹ', meaning: 'Joy, harmony, prosperity', element: 'earth' },
{ name: 'Hagalaz', symbol: 'ᚺ', meaning: 'Disruption, crisis, change', element: 'water' },
{ name: 'Nauthiz', symbol: 'ᚾ', meaning: 'Need, resistance, endurance', element: 'fire' },
{ name: 'Isa', symbol: 'ᛁ', meaning: 'Standstill, concentration, stillness', element: 'water' },
{ name: 'Jera', symbol: 'ᛃ', meaning: 'Harvest, reward, cycles', element: 'earth' },
{ name: 'Eihwaz', symbol: 'ᛇ', meaning: 'Defense, protection, endurance', element: 'earth' },
{ name: 'Perthro', symbol: 'ᛈ', meaning: 'Mystery, fate, secrets', element: 'water' },
{ name: 'Algiz', symbol: 'ᛉ', meaning: 'Protection, higher self, awakening', element: 'air' },
{ name: 'Sowilo', symbol: 'ᛊ', meaning: 'Sun, success, vitality', element: 'fire' },
{ name: 'Tiwaz', symbol: 'ᛏ', meaning: 'Victory, honor, leadership', element: 'air' },
{ name: 'Berkano', symbol: 'ᛒ', meaning: 'Growth, rebirth, fertility', element: 'earth' },
{ name: 'Ehwaz', symbol: 'ᛖ', meaning: 'Movement, progress, partnership', element: 'earth' },
{ name: 'Mannaz', symbol: 'ᛗ', meaning: 'Self, humanity, social order', element: 'air' },
{ name: 'Laguz', symbol: 'ᛚ', meaning: 'Flow, water, emotion', element: 'water' },
{ name: 'Ingwaz', symbol: 'ᛜ', meaning: 'Fertility, new beginnings, potential', element: 'earth' },
{ name: 'Dagaz', symbol: 'ᛞ', meaning: 'Breakthrough, awakening, clarity', element: 'fire' },
{ name: 'Othala', symbol: 'ᛟ', meaning: 'Ancestral property, inheritance, home', element: 'earth' }
];
const I_CHING_HEXAGRAMS = [
{ number: 1, name: 'The Creative', lines: '☰', meaning: 'Creative power, initiative, yang energy' },
{ number: 2, name: 'The Receptive', lines: '☷', meaning: 'Receptivity, devotion, yin energy' },
{ number: 3, name: 'Difficulty', lines: '☵☳', meaning: 'Initial difficulty, perseverance needed' },
{ number: 4, name: 'Youthful Folly', lines: '☶☵', meaning: 'Inexperience, seeking guidance' },
{ number: 5, name: 'Waiting', lines: '☵☰', meaning: 'Patience, nourishment, timing' },
{ number: 6, name: 'Conflict', lines: '☰☵', meaning: 'Opposition, the need for compromise' },
{ number: 7, name: 'The Army', lines: '☷☵', meaning: 'Discipline, organization, leadership' },
{ number: 8, name: 'Holding Together', lines: '☵☷', meaning: 'Unity, alliance, cooperation' },
{ number: 11, name: 'Peace', lines: '☷☰', meaning: 'Harmony, balance, prosperity' },
{ number: 12, name: 'Standstill', lines: '☰☷', meaning: 'Stagnation, retreat, withdrawal' },
{ number: 29, name: 'The Abysmal', lines: '☵☵', meaning: 'Danger, repeated challenges, courage' },
{ number: 30, name: 'The Clinging', lines: '☲☲', meaning: 'Clarity, dependence, fire' },
{ number: 63, name: 'After Completion', lines: '☵☲', meaning: 'Completion, caution, new cycle' },
{ number: 64, name: 'Before Completion', lines: '☲☵', meaning: 'Nearly there, careful progress' }
];
const TAROT_DATA = {
mode: 'tarot',
readings: [],
dailyCard: null,
sessionStartTime: null,
lastReading: null,
fateAlignment: 'neutral',
predictionAccuracy: []
};
// Initialize Tarot System
(function initTarotSystem() {
const saved = localStorage.getItem(APP_NAME + '-tarot');
if (saved) {
try {
const data = JSON.parse(saved);
TAROT_DATA.readings = data.readings || [];
TAROT_DATA.predictionAccuracy = data.predictionAccuracy || [];
TAROT_DATA.fateAlignment = data.fateAlignment || 'neutral';
} catch (e) {
console.error('Failed to load tarot data:', e);
}
}
// Generate daily card based on first movements
setTimeout(() => {
if (state.actionHistory.length > 5 && !TAROT_DATA.dailyCard) {
generateDailyCard();
}
}, 5000);
// Update stats display
updateTarotStats();
})();
function saveTarotData() {
localStorage.setItem(APP_NAME + '-tarot', JSON.stringify({
readings: TAROT_DATA.readings,
predictionAccuracy: TAROT_DATA.predictionAccuracy,
fateAlignment: TAROT_DATA.fateAlignment
}));
}
function switchDivinationMode(mode) {
TAROT_DATA.mode = mode;
// Update button states
document.querySelectorAll('.tarot-mode-btn').forEach(btn => {
btn.classList.remove('active');
if (btn.dataset.mode === mode) {
btn.classList.add('active');
}
});
}
function generateDailyCard() {
// Use first 10 movements to seed the daily card
const movements = state.actionHistory.slice(0, 10);
const seed = movements.reduce((sum, action) => {
return sum + action.x + action.y;
}, 0);
const cardIndex = Math.floor(seed) % MAJOR_ARCANA.length;
TAROT_DATA.dailyCard = MAJOR_ARCANA[cardIndex];
// Display daily card
const dailyCardEl = document.getElementById('tarotDailyCard');
const symbolEl = document.getElementById('tarotDailySymbol');
const nameEl = document.getElementById('tarotDailyName');
if (dailyCardEl && symbolEl && nameEl) {
symbolEl.textContent = TAROT_DATA.dailyCard.symbol;
nameEl.textContent = TAROT_DATA.dailyCard.name;
dailyCardEl.style.display = 'flex';
}
// Add commentary
if (typeof addShadowCommentary === 'function') {
addShadowCommentary(
`The cards have spoken. Your session is guided by ${TAROT_DATA.dailyCard.name}... ${TAROT_DATA.dailyCard.meaning}.`
);
}
}
function analyzeBehaviorForDivination() {
// Analyze recent movement patterns
const recentActions = state.actionHistory.slice(-50);
if (recentActions.length < 10) {
return {
speed: 0.5,
chaos: 0.5,
direction: 0.5,
patterns: []
};
}
// Calculate movement speed
const speeds = [];
for (let i = 1; i < recentActions.length; i++) {
const dx = recentActions[i].x - recentActions[i - 1].x;
const dy = recentActions[i].y - recentActions[i - 1].y;
speeds.push(Math.sqrt(dx * dx + dy * dy));
}
const avgSpeed = speeds.reduce((a, b) => a + b, 0) / speeds.length;
// Calculate chaos (variance in movement)
const directions = [];
for (let i = 1; i < recentActions.length; i++) {
const dx = recentActions[i].x - recentActions[i - 1].x;
const dy = recentActions[i].y - recentActions[i - 1].y;
directions.push(Math.atan2(dy, dx));
}
const dirVariance = calculateVariance(directions);
// Detect patterns (circular, linear, erratic)
const patterns = detectMovementPatterns(recentActions);
return {
speed: Math.min(avgSpeed / 100, 1),
chaos: Math.min(dirVariance / Math.PI, 1),
direction: patterns.dominant,
patterns: patterns.detected
};
}
function calculateVariance(arr) {
const mean = arr.reduce((a, b) => a + b, 0) / arr.length;
const variance = arr.reduce((sum, val) => sum + Math.pow(val - mean, 2), 0) / arr.length;
return variance;
}
function detectMovementPatterns(actions) {
// Simplified pattern detection
let circular = 0, linear = 0, erratic = 0;
for (let i = 2; i < actions.length; i++) {
const dx1 = actions[i - 1].x - actions[i - 2].x;
const dy1 = actions[i - 1].y - actions[i - 2].y;
const dx2 = actions[i].x - actions[i - 1].x;
const dy2 = actions[i].y - actions[i - 1].y;
const angle = Math.abs(Math.atan2(dy2, dx2) - Math.atan2(dy1, dx1));
if (angle < 0.2) linear++;
else if (angle > 1.2 && angle < 2) circular++;
else erratic++;
}
const total = linear + circular + erratic;
return {
detected: { linear, circular, erratic },
dominant: linear > circular && linear > erratic ? 'linear' :
circular > erratic ? 'circular' : 'erratic'
};
}
function drawTarotReading() {
const behavior = analyzeBehaviorForDivination();
let reading;
if (TAROT_DATA.mode === 'tarot') {
reading = performTarotReading(behavior);
} else if (TAROT_DATA.mode === 'iching') {
reading = performIChingReading(behavior);
} else if (TAROT_DATA.mode === 'runes') {
reading = performRuneReading(behavior);
}
// Save reading
TAROT_DATA.readings.push({
timestamp: Date.now(),
mode: TAROT_DATA.mode,
reading: reading,
behavior: behavior
});
saveTarotData();
// Display reading
displayReading(reading);
// Update stats
updateTarotStats();
// Show history
updateTarotHistory();
// Shadow commentary
if (typeof addShadowCommentary === 'function' && reading.prophecy) {
setTimeout(() => {
addShadowCommentary(reading.prophecy);
}, 1500);
}
}
function performTarotReading(behavior) {
// Three card spread: Past (session history), Present (current patterns), Future (predictions)
// Past card - based on session history
const historyIndex = Math.floor(state.sessionDuration / 1000) % MAJOR_ARCANA.length;
const pastCard = MAJOR_ARCANA[historyIndex];
const pastReversed = behavior.chaos > 0.6;
// Present card - based on current behavior
const presentSeed = Math.floor((behavior.speed + behavior.chaos) * 1000);
const presentIndex = presentSeed % MAJOR_ARCANA.length;
const presentCard = MAJOR_ARCANA[presentIndex];
const presentReversed = behavior.patterns.dominant === 'erratic';
// Future card - based on divergence and predictions
const divergence = parseFloat(state.divergenceLevel) / 100;
const futureSeed = Math.floor((divergence + behavior.direction) * 1000);
const futureIndex = futureSeed % MAJOR_ARCANA.length;
const futureCard = MAJOR_ARCANA[futureIndex];
const futureReversed = state.predictionAccuracy < 0.5;
const cards = [
{ ...pastCard, position: 'Past', reversed: pastReversed },
{ ...presentCard, position: 'Present', reversed: presentReversed },
{ ...futureCard, position: 'Future', reversed: futureReversed }
];
const prophecy = generateTarotProphecy(cards, behavior);
return {
type: 'tarot',
spread: 'Three Card Spread',
cards: cards,
prophecy: prophecy
};
}
function performIChingReading(behavior) {
// Generate hexagram from movement sequences
const movements = state.actionHistory.slice(-6);
const lines = movements.map(m => {
const isYang = (m.x + m.y) % 2 === 0;
return isYang;
});
// Find matching hexagram (simplified)
const hexIndex = lines.reduce((acc, line, i) => acc + (line ? Math.pow(2, i) : 0), 0);
const hexagram = I_CHING_HEXAGRAMS[hexIndex % I_CHING_HEXAGRAMS.length];
const prophecy = generateIChingProphecy(hexagram, behavior);
return {
type: 'iching',
hexagram: hexagram,
lines: lines,
prophecy: prophecy
};
}
function performRuneReading(behavior) {
// Cast 5 runes based on movement patterns
const castRunes = [];
const recentActions = state.actionHistory.slice(-10);
for (let i = 0; i < 5; i++) {
const seed = recentActions[i * 2]?.x || 0 + recentActions[i * 2]?.y || 0;
const runeIndex = Math.floor(seed) % ELDER_FUTHARK.length;
castRunes.push(ELDER_FUTHARK[runeIndex]);
}
const prophecy = generateRuneProphecy(castRunes, behavior);
return {
type: 'runes',
runes: castRunes,
prophecy: prophecy
};
}
function generateTarotProphecy(cards, behavior) {
const prophecies = [];
prophecies.push(`The ${cards[0].name} in your past ${cards[0].reversed ? '(reversed) ' : ''}speaks of ${cards[0].reversed ? cards[0].reversed : cards[0].meaning.toLowerCase()}.`);
prophecies.push(`Your present is dominated by ${cards[1].name}${cards[1].reversed ? ' reversed' : ''}, revealing ${cards[1].reversed ? cards[1].reversed : cards[1].meaning.toLowerCase()}.`);
prophecies.push(`The future shows ${cards[2].name}${cards[2].reversed ? ' in reversal' : ''} - expect ${cards[2].reversed ? cards[2].reversed : cards[2].meaning.toLowerCase()}.`);
// Add behavioral interpretation
if (behavior.chaos > 0.7) {
prophecies.push(`Your erratic patterns suggest The Tower approaches. Your behavioral foundation will collapse soon.`);
} else if (behavior.speed < 0.3) {
prophecies.push(`Your stillness mirrors The Hanged Man. Pause and reflection serve you now.`);
} else if (behavior.patterns.dominant === 'circular') {
prophecies.push(`Your circular path echoes the Wheel of Fortune. Cycles govern your fate.`);
}
return prophecies.join(' ');
}
function generateIChingProphecy(hexagram, behavior) {
return `The oracle reveals Hexagram ${hexagram.number}: "${hexagram.name}". ${hexagram.meaning}. Your ${behavior.patterns.dominant} movements suggest ${behavior.chaos > 0.6 ? 'tumultuous change ahead' : 'steady progress'}. ${behavior.speed > 0.7 ? 'Swift action is required.' : 'Patience brings rewards.'}`;
}
function generateRuneProphecy(runes, behavior) {
const prophecy = [`The runes have fallen. ${runes[0].name} (${runes[0].meaning}) dominates your reading.`];
const elements = runes.map(r => r.element);
const elementCount = elements.reduce((acc, el) => {
acc[el] = (acc[el] || 0) + 1;
return acc;
}, {});
const dominant = Object.keys(elementCount).reduce((a, b) => elementCount[a] > elementCount[b] ? a : b);
prophecy.push(`${dominant.charAt(0).toUpperCase() + dominant.slice(1)} energy surrounds you.`);
if (behavior.chaos > 0.6) {
prophecy.push(`Hagalaz whispers of disruption in your chaotic patterns.`);
}
return prophecy.join(' ');
}
function displayReading(reading) {
const overlay = document.getElementById('tarotOverlay');
const title = document.getElementById('tarotReadingTitle');
const subtitle = document.getElementById('tarotReadingSubtitle');
const cardsContainer = document.getElementById('tarotReadingCards');
const prophecyEl = document.getElementById('tarotReadingProphecy');
if (!overlay || !cardsContainer) return;
// Clear previous reading
cardsContainer.innerHTML = '';
if (reading.type === 'tarot') {
title.textContent = reading.spread;
subtitle.textContent = reading.cards.map(c => c.position).join(' • ');
reading.cards.forEach((card, index) => {
const cardEl = document.createElement('div');
cardEl.className = 'tarot-reading-card';
cardEl.innerHTML = `
${card.symbol}
${card.name}
${card.position}
${card.reversed ? '
Reversed
' : ''}
`;
setTimeout(() => {
cardEl.classList.add('revealing');
cardsContainer.appendChild(cardEl);
}, index * 300);
});
} else if (reading.type === 'iching') {
title.textContent = 'I-Ching Hexagram';
subtitle.textContent = `${reading.hexagram.name} (${reading.hexagram.number})`;
const hexEl = document.createElement('div');
hexEl.className = 'hexagram-display';
hexEl.style.margin = '0 auto';
hexEl.style.maxWidth = '400px';
hexEl.innerHTML = `
${reading.hexagram.lines}
${reading.hexagram.name}
${reading.hexagram.meaning}
`;
cardsContainer.appendChild(hexEl);
} else if (reading.type === 'runes') {
title.textContent = 'Rune Casting';
subtitle.textContent = 'The Elder Futhark Speaks';
const runeCast = document.createElement('div');
runeCast.className = 'rune-cast';
reading.runes.forEach((rune, index) => {
const runeEl = document.createElement('div');
runeEl.className = 'rune-stone';
runeEl.innerHTML = `
${rune.symbol}
${rune.name}
`;
setTimeout(() => {
runeEl.classList.add('revealing');
runeCast.appendChild(runeEl);
}, index * 200);
});
cardsContainer.appendChild(runeCast);
}
prophecyEl.textContent = reading.prophecy;
// Show overlay
setTimeout(() => {
overlay.classList.add('visible');
}, 100);
}
function closeTarotReading() {
const overlay = document.getElementById('tarotOverlay');
if (overlay) {
overlay.classList.remove('visible');
}
}
function updateTarotStats() {
const countEl = document.getElementById('tarotReadingsCount');
const accuracyEl = document.getElementById('tarotAccuracy');
const alignmentEl = document.getElementById('tarotFateAlignment');
if (countEl) countEl.textContent = TAROT_DATA.readings.length;
if (accuracyEl && TAROT_DATA.predictionAccuracy.length > 0) {
const avgAccuracy = TAROT_DATA.predictionAccuracy.reduce((a, b) => a + b, 0) / TAROT_DATA.predictionAccuracy.length;
accuracyEl.textContent = Math.round(avgAccuracy * 100) + '%';
}
if (alignmentEl) {
alignmentEl.textContent = TAROT_DATA.fateAlignment;
}
}
function updateTarotHistory() {
const historyEl = document.getElementById('tarotHistory');
if (!historyEl) return;
if (TAROT_DATA.readings.length === 0) {
historyEl.style.display = 'none';
return;
}
historyEl.style.display = 'block';
historyEl.innerHTML = '';
// Show last 5 readings
const recentReadings = TAROT_DATA.readings.slice(-5).reverse();
recentReadings.forEach(reading => {
const entry = document.createElement('div');
entry.className = 'tarot-history-entry';
const date = new Date(reading.timestamp);
const dateStr = date.toLocaleDateString() + ' ' + date.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
let cardsStr = '';
if (reading.reading.type === 'tarot') {
cardsStr = reading.reading.cards.map(c => c.name).join(', ');
} else if (reading.reading.type === 'iching') {
cardsStr = reading.reading.hexagram.name;
} else if (reading.reading.type === 'runes') {
cardsStr = reading.reading.runes.map(r => r.symbol).join(' ');
}
entry.innerHTML = `
${dateStr}
${cardsStr}
`;
historyEl.appendChild(entry);
});
}
// Integrate with existing prediction system to track accuracy
if (typeof state !== 'undefined') {
const originalPredict = window.makePrediction || function() {};
window.makePrediction = function(...args) {
const result = originalPredict.apply(this, args);
// Track if last reading's prediction came true
if (TAROT_DATA.readings.length > 0 && result) {
const accuracy = state.predictionAccuracy || 0.5;
TAROT_DATA.predictionAccuracy.push(accuracy);
// Update fate alignment based on accuracy
if (accuracy > 0.8) {
TAROT_DATA.fateAlignment = 'Aligned';
} else if (accuracy < 0.4) {
TAROT_DATA.fateAlignment = 'Divergent';
} else {
TAROT_DATA.fateAlignment = 'Neutral';
}
saveTarotData();
updateTarotStats();
}
return result;
};
}