<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Stories</title>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: Arial, sans-serif;
background: #f3f4f6;
}
#container {
width: 90%;
max-width: 600px;
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
height: 90%;
box-sizing: border-box;
}
h1 {
margin: 0;
font-size: 2.5em;
color: #333;
}
#language-switch {
position: absolute;
top: 10px;
right: 10px;
width: 80px;
user-select: none;
}
.custom-select {
position: relative;
display: inline-block;
}
.select-selected {
background-color: #4CAF50;
color: white;
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
text-align: center;
transition: background-color 0.3s ease;
}
.select-selected:hover {
background-color: #45a049;
}
.select-items {
position: absolute;
background-color: white;
border: 1px solid #ddd;
border-radius: 8px;
width: 100%;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
z-index: 99;
display: none;
animation: slideDown 0.3s forwards;
}
.select-items.open {
display: block;
animation: slideDown 0.3s forwards;
}
.select-items div {
color: #333;
padding: 8px 12px;
cursor: pointer;
transition: background-color 0.3s;
}
.select-items div:hover {
background-color: #f1f1f1;
}
textarea {
width: 100%;
flex-grow: 1;
resize: none;
padding: 10px;
font-size: 1em;
border-radius: 8px;
border: 1px solid #ccc;
box-sizing: border-box;
min-height: 100px;
max-height: 200px;
}
textarea:focus {
outline: none;
border-color: blue;
}
button {
padding: 10px 20px;
font-size: 1.2em;
border-radius: 8px;
border: none;
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #45a049;
}
@keyframes slideDown {
from { max-height: 0; opacity: 0; }
to { max-height: 500px; opacity: 1; }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
</style>
<script>
function switchLanguage(language) {
const textElements = {
title: { ru: "AI Stories", en: "AI Stories" },
button: { ru: "Придумать историю", en: "Generate Story" },
placeholder: { ru: "Введите текст здесь...", en: "Enter text here..." }
};
document.querySelector('h1').innerText = textElements.title[language];
document.querySelector('button').innerText = textElements.button[language];
document.querySelector('textarea').placeholder = textElements.placeholder[language];
}
document.addEventListener('DOMContentLoaded', () => {
const selected = document.querySelector('.select-selected');
const items = document.querySelector('.select-items');
selected.addEventListener('click', function() {
items.classList.toggle('open');
});
document.querySelectorAll('.select-items div').forEach(item => {
item.addEventListener('click', function() {
selected.textContent = this.textContent;
items.classList.remove('open');
switchLanguage(this.getAttribute('data-value'));
});
});
document.addEventListener('click', function(e) {
if (!e.target.closest('.custom-select')) {
items.classList.remove('open');
}
});
});
</script>
</head>
<body>
<div id="language-switch" class="custom-select">
<div class="select-selected">RU</div>
<div class="select-items">
<div data-value="ru">RU</div>
<div data-value="en">EN</div>
</div>
</div>
<div id="container">
<h1>AI Stories</h1>
<textarea placeholder="Введите текст здесь..."></textarea>
<button onclick="alert('История создана!')">Придумать историю</button>
</div>
</body>
</html>