<style>
.copy-box {
max-width: 100%;
background: #0f172a;
color: #ffffff;
padding: 15px;
border-radius: 10px;
position: relative;
font-family: Consolas, monospace;
overflow: hidden;
}
.copy-box textarea {
width: 100%;
background: transparent;
border: none;
outline: none;
resize: none;
color: #ffffff;
font-size: 15px;
line-height: 1.6;
min-height: 140px;
}
.copy-btn {
position: absolute;
top: 10px;
right: 10px;
background: linear-gradient(45deg,#22c55e,#16a34a);
color: #ffffff;
border: none;
padding: 6px 14px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
transition: 0.3s;
}
.copy-btn:hover {
transform: scale(1.05);
background: linear-gradient(45deg,#16a34a,#15803d);
}
</style>
<div class="copy-box">
<button class="copy-btn" onclick="copyText(this)">Copy</button>
<textarea id="copyTextArea">
AAAA
</textarea>
</div>
<script>
function copyText(btn) {
let textarea = btn.parentElement.querySelector("textarea");
textarea.select();
textarea.setSelectionRange(0, 99999);
document.execCommand("copy");
btn.innerHTML = "Copied!";
setTimeout(() => {
btn.innerHTML = "Copy";
}, 1500);
}
</script>

