* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
max-width: 900px;
width: 100%;
}
.header {
text-align: center;
color: white;
margin-bottom: 40px;
}
.header h1 {
font-size: 2.8rem;
font-weight: 700;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}
.header p {
font-size: 1.1rem;
opacity: 0.95;
}
.main-card {
background: white;
border-radius: 20px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
margin-bottom: 30px;
}
.result-display {
text-align: center;
padding: 50px 20px;
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
border-radius: 16px;
margin-bottom: 30px;
min-height: 200px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
}
.result-display::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
animation: pulse 3s infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.5; }
50% { transform: scale(1.1); opacity: 0.8; }
}
.word-container {
position: relative;
z-index: 1;
}
.adjective {
font-size: 3rem;
font-weight: 700;
color: #fff;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
margin-bottom: 10px;
animation: slideIn 0.5s ease;
}
.noun {
font-size: 3rem;
font-weight: 700;
color: #fff;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
animation: slideIn 0.5s ease 0.2s backwards;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.placeholder-text {
color: rgba(255, 255, 255, 0.7);
font-size: 1.5rem;
font-style: italic;
}
.controls {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 30px;
}
.btn {
padding: 16px 32px;
border: none;
border-radius: 12px;
font-weight: 600;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.btn-generate {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
}
.btn-generate:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}
.btn-adjective {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
.btn-adjective:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}
.btn-noun {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
color: white;
}
.btn-noun:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(67, 233, 123, 0.4);
}
.btn-copy {
background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
color: white;
}
.btn-copy:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
}
.btn:active {
transform: translateY(0);
}
.history-section {
background: #f8f9fa;
padding: 25px;
border-radius: 16px;
margin-top: 20px;
}
.history-title {
font-size: 1.3rem;
font-weight: 700;
color: #2c3e50;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
}
.history-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
max-height: 200px;
overflow-y: auto;
padding-right: 10px;
}
.history-list::-webkit-scrollbar {
width: 8px;
}
.history-list::-webkit-scrollbar-track {
background: #e0e0e0;
border-radius: 10px;
}
.history-list::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
border-radius: 10px;
}
.history-item {
background: white;
padding: 10px 16px;
border-radius: 20px;
font-size: 14px;
color: #555;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transition: all 0.3s;
cursor: pointer;
}
.history-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
}
.empty-history {
text-align: center;
color: #999;
padding: 20px;
font-style: italic;
}
.stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin-top: 20px;
}
.stat-card {
background: white;
padding: 20px;
border-radius: 12px;
text-align: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.stat-number {
font-size: 2rem;
font-weight: 700;
color: #f5576c;
margin-bottom: 5px;
}
.stat-label {
font-size: 0.9rem;
color: #777;
font-weight: 600;
}
.icon {
font-size: 24px;
}
.toast {
position: fixed;
top: 30px;
right: 30px;
background: white;
padding: 16px 24px;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
display: none;
align-items: center;
gap: 12px;
z-index: 1000;
animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
from {
transform: translateX(400px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.toast.show {
display: flex;
}
.toast-icon {
width: 40px;
height: 40px;
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 20px;
}
@media (max-width: 768px) {
.header h1 {
font-size: 2rem;
}
.adjective, .noun {
font-size: 2rem;
}
.controls {
grid-template-columns: 1fr;
}
.stats {
grid-template-columns: 1fr;
}
.toast {
top: 15px;
right: 15px;
left: 15px;
}
}
const adjectives = [
'Amazing', 'Brilliant', 'Creative', 'Daring', 'Elegant', 'Fancy', 'Gorgeous', 'Happy',
'Incredible', 'Joyful', 'Kind', 'Luminous', 'Majestic', 'Noble', 'Outstanding', 'Perfect',
'Quick', 'Radiant', 'Sparkling', 'Tremendous', 'Unique', 'Vibrant', 'Wonderful', 'Excellent',
'Zealous', 'Awesome', 'Bright', 'Charming', 'Delightful', 'Energetic', 'Fabulous', 'Glorious',
'Harmonious', 'Impressive', 'Jolly', 'Keen', 'Lively', 'Magnificent', 'Neat', 'Optimistic',
'Pleasant', 'Quirky', 'Remarkable', 'Stunning', 'Terrific', 'Upbeat', 'Vivacious', 'Witty',
'Youthful', 'Zesty', 'Adorable', 'Bold', 'Clever', 'Dynamic', 'Epic', 'Fierce', 'Graceful',
'Heroic', 'Inspiring', 'Jazzy', 'Magical', 'Mystical', 'Powerful', 'Royal', 'Sleek', 'Swift'
];
const nouns = [
'Dragon', 'Phoenix', 'Tiger', 'Eagle', 'Lion', 'Wolf', 'Bear', 'Falcon',
'Panther', 'Hawk', 'Cobra', 'Shark', 'Dolphin', 'Unicorn', 'Griffin', 'Pegasus',
'Thunder', 'Lightning', 'Storm', 'Blaze', 'Frost', 'Shadow', 'Spirit', 'Legend',
'Champion', 'Warrior', 'Knight', 'Hero', 'Master', 'Wizard', 'Ninja', 'Samurai',
'Explorer', 'Voyager', 'Pioneer', 'Guardian', 'Defender', 'Crusader', 'Ranger', 'Hunter',
'Artist', 'Genius', 'Prodigy', 'Scholar', 'Sage', 'Oracle', 'Prophet', 'Mystic',
'Star', 'Moon', 'Sun', 'Comet', 'Meteor', 'Galaxy', 'Nova', 'Nebula',
'Mountain', 'Ocean', 'River', 'Forest', 'Desert', 'Volcano', 'Canyon', 'Valley'
];
let currentAdjective = '';
let currentNoun = '';
let history = [];
let stats = {
total: 0,
adjectives: 0,
nouns: 0
};
function getRandomItem(array) {
return array[Math.floor(Math.random() * array.length)];
}
function updateDisplay() {
const display = document.getElementById('resultDisplay');
if (currentAdjective || currentNoun) {
display.innerHTML = `
<div class="word-container">
${currentAdjective ? `<div class="adjective">${currentAdjective}</div>` : ''}
${currentNoun ? `<div class="noun">${currentNoun}</div>` : ''}
</div>
`;
} else {
display.innerHTML = `
<div class="word-container">
<div class="placeholder-text">Click generate to start!</div>
</div>
`;
}
}
function generateAdjective() {
currentAdjective = getRandomItem(adjectives);
stats.adjectives++;
stats.total++;
updateDisplay();
updateStats();
if (currentNoun) addToHistory();
}
function generateNoun() {
currentNoun = getRandomItem(nouns);
stats.nouns++;
stats.total++;
updateDisplay();
updateStats();
if (currentAdjective) addToHistory();
}
function generateBoth() {
currentAdjective = getRandomItem(adjectives);
currentNoun = getRandomItem(nouns);
stats.adjectives++;
stats.nouns++;
stats.total += 2;
updateDisplay();
updateStats();
addToHistory();
}
function addToHistory() {
if (currentAdjective && currentNoun) {
const combination = `${currentAdjective} ${currentNoun}`;
history.unshift(combination);
if (history.length > 20) history.pop();
updateHistory();
}
}
function updateHistory() {
const historyList = document.getElementById('historyList');
if (history.length === 0) {
historyList.innerHTML = '<div class="empty-history">No generations yet. Start creating!</div>';
} else {
historyList.innerHTML = history.map(item =>
`<div class="history-item" onclick="restoreFromHistory('${item}')">${item}</div>`
).join('');
}
}
function restoreFromHistory(combination) {
const parts = combination.split(' ');
currentAdjective = parts[0];
currentNoun = parts.slice(1).join(' ');
updateDisplay();
}
function updateStats() {
document.getElementById('totalGenerated').textContent = stats.total;
document.getElementById('totalAdjectives').textContent = stats.adjectives;
document.getElementById('totalNouns').textContent = stats.nouns;
}
function copyToClipboard() {
if (!currentAdjective && !currentNoun) {
showToast('Nothing to copy! Generate something first.', false);
return;
}
const text = `${currentAdjective || ''} ${currentNoun || ''}`.trim();
navigator.clipboard.writeText(text).then(() => {
showToast('Copied to clipboard!', true);
}).catch(() => {
showToast('Failed to copy. Please try again.', false);
});
}
function showToast(message, success) {
const toast = document.getElementById('toast');
const icon = toast.querySelector('.toast-icon');
const text = toast.querySelector('span');
text.textContent = message;
icon.textContent = success ? '✓' : '✗';
icon.style.background = success
? 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)'
: 'linear-gradient(135deg, #f5576c 0%, #f093fb 100%)';
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 3000);
}
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
generateBoth();
} else if (e.key === 'a' || e.key === 'A') {
generateAdjective();
} else if (e.key === 'n' || e.key === 'N') {
generateNoun();
} else if (e.key === 'c' || e.key === 'C') {
copyToClipboard();
}
});
window.restoreFromHistory = restoreFromHistory;
No comments yet. Be the first!