:root {
    --bg: #000;
    --surface: #0a0a0a;
    --border: #222;
    --primary: #fff;
    --glass: rgba(10, 10, 10, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"), radial-gradient(circle at 50% 0%, #1c1c1c 0%, #000 70%);
    color: var(--primary);
    font-family: 'Manrope', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- TOP BAR --- */
.top-bar {
    position: absolute; top: 0; left: 0; right: 0;
    height: 60px; display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px; z-index: 10; pointer-events: none;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; pointer-events: auto; color: #fff; text-shadow: 0 0 20px rgba(255,255,255,0.3); }

.social-dock { display: flex; gap: 10px; pointer-events: auto; }
.social-icon {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    color: #888; border-radius: 50%; transition: 0.2s; background: rgba(255,255,255,0.05);
    border: 1px solid transparent; text-decoration: none;
}
.social-icon:hover { background: #fff; color: #000; transform: translateY(-2px); }

/* --- CANVAS --- */
.canvas {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; z-index: 1; perspective: 1000px;
}

/* HERO STATE */
.hero-state {
    position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 20px; pointer-events: none; transition: 0.3s;
}
.hero-state.hidden { opacity: 0; transform: scale(0.9); pointer-events: none; }

.core-visual { width: 120px; height: 120px; position: relative; display: flex; align-items: center; justify-content: center; }
.core-circle { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); }
.c1 { width: 100%; height: 100%; animation: spin 10s linear infinite; border-top-color: #fff; }
.c2 { width: 70%; height: 70%; animation: spin 7s linear infinite reverse; border-bottom-color: #888; }
.c3 { width: 40%; height: 40%; background: #fff; box-shadow: 0 0 30px rgba(255,255,255,0.5); animation: pulse 3s ease-in-out infinite; }

.hero-text { text-align: center; }
.hero-text h1 { font-size: 16px; letter-spacing: 3px; text-transform: uppercase; color: #666; margin-bottom: 8px; }
.hero-text p { font-size: 13px; color: #444; }

/* IMAGE WRAPPER */
.img-wrapper {
    position: relative; max-width: 90%; max-height: 60vh;
    border-radius: 20px; box-shadow: 0 0 0 1px #222, 0 30px 80px rgba(0,0,0,0.9);
    overflow: hidden; opacity: 0; transform: rotateX(5deg) scale(0.95);
    transition: 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: none; align-items: center; justify-content: center;
    background: #050505;
}
.img-wrapper.visible { opacity: 1; transform: rotateX(0) scale(1); display: flex; }
.generated-img { max-width: 100%; max-height: 60vh; display: block; }
.scan-line {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateY(-100%); animation: scan 1.5s infinite;
    display: none; pointer-events: none; z-index: 10;
}
.img-wrapper.loading .scan-line { display: block; }

.image-actions {
    position: absolute; bottom: 20px; right: 20px;
    display: flex; gap: 10px; z-index: 20;
    opacity: 0; transform: translateY(10px); transition: 0.3s;
}
.img-wrapper.visible:hover .image-actions, .img-wrapper.visible .image-actions { opacity: 1; transform: translateY(0); }
.action-btn {
    width: 44px; height: 44px; border-radius: 12px;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s;
}
.action-btn:hover { background: #fff; color: #000; transform: scale(1.1); }
.action-btn svg { width: 20px; height: 20px; }

/* --- DOCK --- */
.dock-container {
    position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 680px; z-index: 100;
}
.input-card {
    background: var(--glass); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border); border-radius: 24px; padding: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 10px; transition: 0.3s;
}
.input-card:focus-within { border-color: #444; transform: translateY(-4px); box-shadow: 0 30px 70px rgba(0,0,0,0.8); }

.settings-row { display: flex; gap: 8px; align-items: center; }
.chip {
    background: rgba(255,255,255,0.05); border: 1px solid transparent;
    color: #bbb; padding: 6px 14px; border-radius: 100px; font-size: 12px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.chip:hover { background: rgba(255,255,255,0.1); color: #fff; }
.chip.active { background: #fff; color: #000; border-color: #fff; box-shadow: 0 0 15px rgba(255,255,255,0.2); }
.chip svg { width: 10px; height: 10px; opacity: 0.8; }

.input-row { display: flex; gap: 10px; align-items: flex-end; }
.dice-btn {
    width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,0.05);
    border: 1px solid transparent; color: #888; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s; flex-shrink: 0;
}
.dice-btn:hover { background: rgba(255,255,255,0.1); color: #fff; transform: rotate(15deg); }
.prompt-box {
    flex: 1; background: transparent; border: none; color: #fff; font-size: 15px; font-family: inherit;
    padding: 12px 5px; resize: none; height: 44px; max-height: 120px; outline: none; line-height: 1.4;
}
.prompt-box::placeholder { color: #555; }
.send-btn {
    width: 44px; height: 44px; border-radius: 14px; background: #fff; border: none; color: #000;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; flex-shrink: 0;
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 0 15px rgba(255,255,255,0.3); }
.send-btn:disabled { background: #333; color: #666; cursor: not-allowed; transform: none; box-shadow: none; }

/* --- POPUPS --- */
.popup-menu {
    position: absolute; bottom: 115%; left: 0; background: #161616; border: 1px solid #333;
    border-radius: 16px; padding: 8px; display: none; flex-direction: column; gap: 4px;
    width: 220px; box-shadow: 0 10px 40px rgba(0,0,0,0.8); z-index: 200;
    animation: popUp 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.popup-menu.show { display: flex; }
.menu-option {
    padding: 12px; border-radius: 10px; cursor: pointer; font-size: 13px; color: #aaa;
    display: flex; justify-content: space-between;
}
.menu-option:hover { background: #222; color: #fff; }
.menu-option.selected { background: #222; color: #fff; font-weight: 600; }
.menu-option.selected::after { content: '✓'; color: #fff; }

/* --- HISTORY --- */
.history-strip {
    position: absolute; bottom: 0; left: 0; right: 0; height: 100px;
    background: linear-gradient(to top, #000 0%, rgba(0,0,0,0.8) 100%);
    display: flex; align-items: center; padding: 0 24px; gap: 12px;
    overflow-x: auto; z-index: 50; mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}
.history-strip::-webkit-scrollbar { display: none; }
.history-item {
    min-width: 70px; height: 70px; border-radius: 12px; background: #111; border: 1px solid #333;
    overflow: hidden; cursor: pointer; transition: 0.3s; position: relative; opacity: 0.6;
}
.history-item:hover { opacity: 1; transform: translateY(-10px) scale(1.1); border-color: #fff; z-index: 10; }
.history-item img { width: 100%; height: 100%; object-fit: cover; }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(0.95); opacity: 0.8; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@keyframes popUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
    .dock-container { width: 95%; bottom: 110px; }
    .history-strip { height: 90px; mask-image: none; }
    .brand { font-size: 18px; }
    .hero-state { transform: scale(0.8); }
}
