:root {
    --primary: #007AFF;
    --primary-soft: #edf5ff;
    --bg: #f7f9fc;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --card-border: #e5e5ea;
    --highlight: #ff2d55;
    --whatsapp: #25D366;
    --accent: linear-gradient(90deg, #007AFF, #9b51e0, #ff2d55);
}

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

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background: var(--bg); color: var(--text); min-height: 100vh;
    display: flex; flex-direction: column; text-align: center;
}

main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 32px 16px 40px; }
.calc-box { width: 100%; max-width: 850px; position: relative; z-index: 1; }

.rainbow-wrapper {
    padding: 1px; border-radius: 28px; background: var(--card-border);
    margin-bottom: 36px; box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}
.rainbow-wrapper::before { content: ""; display: block; height: 5px; background: var(--accent); }

.surprise-card { background: #fff; border-radius: 27px; padding: 34px; border: none; position: relative; }
.studio-tag { font-size: 0.68rem; font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: 0; display: block; margin-bottom: 10px; }
.tool-title { font-size: clamp(1.8rem, 5vw, 2.55rem); line-height: 1.08; font-weight: 900; margin-bottom: 24px; }

.input-group { text-align: left; margin-bottom: 18px; }
label { font-size:.7rem; font-weight:900; color:var(--primary); text-transform:uppercase; letter-spacing:0; margin-bottom:8px; display:block; text-align: left; }
input { width: 100%; min-height: 52px; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--card-border); font-size: 1.1rem; font-weight: 700; background: #fafafa; outline: none; text-align: left; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; }
input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(0,122,255,0.1); }

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.theme-card {
    padding: 14px;
    background: #fbfbfd;
    border: 2px solid #f2f2f7;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #444;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    user-select: none;
}
.theme-card:hover { border-color: #d1d1d6; background: #f2f2f7; }
.theme-card.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 4px 10px rgba(0,122,255,0.15); }

.btn-primary { width: 100%; min-height: 52px; padding: 16px 18px; border-radius: 14px; border: none; background: var(--primary); color: white; font-weight: 800; font-size: 1rem; text-transform: uppercase; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,122,255,0.3); margin-top: 10px; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,122,255,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary { background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(0,122,255,0.16); min-height: 48px; padding: 13px 18px; border-radius: 14px; font-weight: 800; cursor: pointer; width: 100%; transition: 0.2s; font-size: 0.95rem; }
.btn-secondary:hover { background: #e2f0ff; border-color: rgba(0,122,255,0.28); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 25px; }
@media(max-width: 600px){ .action-grid { grid-template-columns: 1fr; } }
.btn-action { background: #fff; border: 2px solid var(--card-border); padding: 14px; border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; color: var(--text); }
.btn-action:hover { border-color: var(--primary); color: var(--primary); }

.share-box { background: #fbfbfd; padding: 25px; border-radius: 20px; border: 1px dashed #d1d1d6; }

.icon-actions { display: flex; gap: 15px; justify-content: center; }
.icon-btn { width: 50px; height: 50px; border-radius: 50%; border: none; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,122,255,0.3); }
.icon-btn.whatsapp { background: var(--whatsapp); box-shadow: 0 4px 15px rgba(37,211,102,0.3); }
.icon-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,122,255,0.4); }
.icon-btn:active { transform: scale(0.95); }

/* Layout Split */
.app-layout { display: flex; gap: 30px; align-items: flex-start; }
.controls-side { flex: 1; min-width: 300px; }
.preview-side { flex: 1; min-width: 300px; display: flex; flex-direction: column; }
.preview-container { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.1); position: relative; }
#preview-canvas { width: 100%; height: 100%; display: block; }

@media(max-width: 800px) {
    .app-layout { flex-direction: column-reverse; }
    .controls-side, .preview-side { width: 100%; min-width: 0; }
}

/* Guide */
.guide-container { width: 90%; max-width: 1400px; margin: 60px auto 40px; padding: 0 16px; background: rgba(255,255,255,0.7); border-radius: 45px; border: 1px solid #f0f0f0; backdrop-filter: blur(20px); }
.guide-container h2 { font-size: 2.2rem; font-weight: 900; color: var(--primary); margin-bottom: 25px; letter-spacing: 0; }
.guide-container h3 { font-size: 1.4rem; font-weight: 800; margin: 35px 0 15px; border-left: 5px solid var(--primary); padding-left: 15px; text-align: left;}
.guide-container p { font-size: 1.1rem; line-height: 1.8; color: #444; margin-bottom: 20px; font-weight: 500; text-align: left;}
.guide-container ul { list-style: none; margin: 20px 0; text-align: left;}
.guide-container li { margin-bottom: 12px; font-weight: 600; color: #333; position: relative; padding-left: 25px; }
.guide-container li::before { content: '→'; position: absolute; left: 0; color: var(--primary); }

/* Full Screen Player Overlay */
.player-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #000; z-index: 9999; display: none;
    overflow: hidden;
}

#animation-canvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}

#text-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 10;
}

.skip-btn {
    position: absolute; top: 30px; right: 30px;
    color: rgba(255,255,255,0.6); font-weight: 700; font-size: 1rem;
    cursor: pointer; z-index: 20; padding: 10px 20px; border-radius: 20px;
    background: rgba(255,255,255,0.1); backdrop-filter: blur(5px);
    transition: 0.3s;
}
.skip-btn:hover { background: rgba(255,255,255,0.2); color: white; }

.recording-indicator {
    position: absolute; top: 30px; left: 30px;
    color: #ff3b30; font-weight: 800; font-size: 0.9rem;
    display: none; align-items: center; gap: 8px; z-index: 20;
    background: rgba(0,0,0,0.5); padding: 8px 16px; border-radius: 20px;
}
.red-dot {
    width: 10px; height: 10px; border-radius: 50%; background: #ff3b30;
    animation: blink 1s infinite;
}
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }

/* Theme Text Styles inside the #text-overlay */
.name-text {
    opacity: 0;
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

/* 1. Galaxy */
.name-galaxy {
    font-family: 'Inter', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #fff; text-shadow: 0 0 20px #fff, 0 0 40px #a1c4fd, 0 0 80px #c2e9fb;
    letter-spacing: 5px; text-transform: uppercase;
    transform: scale(0.5); transition: all 2s cubic-bezier(0.1, 1, 0.2, 1);
}
.name-galaxy.show { opacity: 1; transform: scale(1); }

/* 2. Fire */
.name-fire {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #ff9d00; text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000, 0 0 80px #ff9d00;
    letter-spacing: 5px; text-transform: uppercase;
    transform: translateY(50px); transition: all 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.name-fire.show { opacity: 1; transform: translateY(0); }

/* 3. Lightning */
.name-lightning {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #e0f7fa; text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px #00e5ff, 0 0 80px #00e5ff;
    letter-spacing: 5px; text-transform: uppercase;
    animation: flashText 0.2s 3;
    opacity: 1;
}
@keyframes flashText { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* 4. Hacker */
.name-hacker {
    font-family: 'Share Tech Mono', monospace; font-size: clamp(2.5rem, 8vw, 7rem);
    color: #0f0; text-shadow: 0 0 10px #0f0;
    text-transform: uppercase;
    border-right: 4px solid #0f0;
    white-space: nowrap; overflow: hidden; width: 0;
    animation: typing 2s steps(20, end) forwards, blinkCursor .75s step-end infinite;
    opacity: 1;
}
@keyframes typing { from { width: 0 } to { width: 100% } }
@keyframes blinkCursor { from, to { border-color: transparent } 50% { border-color: #0f0 } }

/* 5. Luxury Gold */
.name-luxury {
    font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(3rem, 10vw, 8rem);
    background: linear-gradient(to right, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-transform: uppercase; letter-spacing: 10px;
    opacity: 0; transform: scale(1.1); transition: all 3s ease-out;
}
.name-luxury.show { opacity: 1; transform: scale(1); }

/* 6. Space Launch */
.name-space {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #fff; text-shadow: 0 0 30px #ff3b30, 0 0 60px #ff9500;
    text-transform: uppercase; letter-spacing: 8px;
    opacity: 0; transform: scale(0.2); transition: all 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.name-space.show { opacity: 1; transform: scale(1); }

/* 7. AI */
.name-ai {
    font-family: 'Inter', sans-serif; font-weight: 900; font-size: clamp(2.5rem, 8vw, 7rem);
    color: #fff; text-shadow: 0 0 20px #007aff, 0 0 40px #007aff;
    text-transform: uppercase; letter-spacing: 2px;
    opacity: 0; filter: blur(10px); transition: all 1.5s ease-out;
}
.name-ai.show { opacity: 1; filter: blur(0); }

/* 8. Cyberpunk */
.name-cyberpunk {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #fff; text-shadow: 0 0 10px #fff, 0 0 20px #ff00ff, 0 0 30px #ff00ff, 0 0 40px #ff00ff, 0 0 70px #ff00ff;
    text-transform: uppercase; letter-spacing: 4px;
    transform: skewX(-15deg); opacity: 0; transition: all 0.5s ease;
}
.name-cyberpunk.show { opacity: 1; transform: skewX(-15deg) scale(1.1); }

/* 9. Royal */
.name-royal {
    font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(3rem, 10vw, 8rem);
    color: #fff; text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700;
    text-transform: uppercase; letter-spacing: 6px;
    opacity: 0; transform: translateY(30px); transition: all 2s ease;
}
.name-royal.show { opacity: 1; transform: translateY(0); }

/* 10. Movie */
.name-movie {
    font-family: 'Inter', sans-serif; font-weight: 900; font-size: clamp(3rem, 10vw, 8rem);
    color: #a1a1a6; text-shadow: 0 5px 15px rgba(0,0,0,0.8);
    text-transform: uppercase; letter-spacing: 15px;
    opacity: 0; transform: scale(0.9); transition: all 4s linear;
}
.name-movie.show { opacity: 1; transform: scale(1.1); color: #fff; text-shadow: 0 0 20px #fff; }
