@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;700;900&display=swap');

:root {
    --bg: #f4e04d;
    --accent: #ff00ff;
    --black: #000000;
    --white: #ffffff;
    --green: #00ff66;
}

body {
    background-color: var(--bg);
    font-family: 'Space Grotesk', sans-serif;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-grid {
    display: grid;
    grid-template-areas: 
        "header header"
        "presets input"
        "presets display";
    grid-template-columns: 250px 1fr;
    gap: 20px;
    max-width: 1100px;
    width: 100%;
}

.bento-box {
    background: var(--white);
    border: 4px solid var(--black);
    box-shadow: 8px 8px 0px var(--black);
    padding: 20px;
    position: relative;
}

/* Header Styling */
.header h1 { font-size: 2.5rem; font-weight: 900; line-height: 1; }
.subtitle { font-size: 0.7rem; font-weight: 700; letter-spacing: 2px; margin-top: 5px; }
.status-group { display: flex; gap: 20px; }
.status-item { display: flex; flex-direction: column; text-align: right; }
.label { font-size: 0.6rem; font-weight: 900; color: #666; }
.value { font-size: 1.2rem; font-weight: 900; }

.color-green { color: var(--green); text-shadow: 1px 1px var(--black); }
.color-pink { color: var(--accent); }
.color-red { color: red; }

/* Style Tags */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.tag {
    background: var(--black);
    color: var(--white);
    border: none;
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.tag:hover { background: var(--accent); transform: rotate(-2deg); }

/* --- RESTRUCTURED CONTROLS --- */
textarea {
    width: 100%;
    height: 120px;
    border: 3px solid var(--black);
    padding: 15px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    outline: none;
}

.controls { 
    display: flex; 
    flex-direction: column; /* Stack vertically */
    gap: 10px; 
    margin-top: 15px; 
}

.btn-row {
    display: flex; /* Side-by-side row for Clear/Save */
    gap: 10px;
}

.main-btn { 
    width: 100%; 
    background: var(--accent); 
    color: white; 
    border: 3px solid var(--black); 
    padding: 18px; 
    font-weight: 900; 
    cursor: pointer; 
    box-shadow: 4px 4px 0px var(--black);
    text-transform: uppercase;
}

.sec-btn, .dl-btn { 
    flex: 1; 
    padding: 12px;
    border: 3px solid var(--black); 
    font-weight: 900; 
    cursor: pointer; 
    box-shadow: 4px 4px 0px var(--black);
    text-transform: uppercase;
}

.sec-btn { background: #ddd; }
.dl-btn { background: var(--green); color: var(--black); }

.main-btn:active, .sec-btn:active, .dl-btn:active {
    box-shadow: 0px 0px 0px var(--black);
    transform: translate(2px, 2px);
}

/* Image Display Area */
.display-area { min-height: 450px; display: flex; justify-content: center; align-items: center; background: #111; color: var(--white); overflow: hidden; }
#output-img { width: 100%; height: auto; transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.glitch-spinner {
    width: 60px;
    height: 60px;
    border: 8px solid var(--accent);
    border-right-color: var(--bg);
    border-radius: 50%;
    animation: spin 0.6s infinite linear;
}

@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (max-width: 768px) {
    .main-grid { grid-template-areas: "header" "input" "presets" "display"; grid-template-columns: 1fr; }
    body { padding: 10px; }
}