:root {
    --primary: #007AFF;
    --bg: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --card-border: #e5e5ea;
    --rainbow: linear-gradient(45deg, #ff9a9e, #fad0c4, #ffecd2, #a1c4fd, #c2e9fb, #d4fc79, #84fab0);
}

* { 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: center; padding: 40px 16px; }
.calc-box { width: 100%; max-width: 900px; position: relative; z-index: 1; }

.rainbow-wrapper {
    padding: 4px; border-radius: 44px; background: var(--rainbow);
    background-size: 300%; animation: rainbowMove 6s linear infinite;
    margin-bottom: 40px; box-shadow: 0 20px 50px rgba(0,0,0,0.05);
}
@keyframes rainbowMove { 0% { background-position: 0% 50% } 50% { background-position: 100% 50% } 100% { background-position: 0% 50% } }

.opt-card { background: #fff; border-radius: 40px; padding: 45px 35px; border: none; position: relative; }
.studio-tag { font-size: 0.65rem; font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: 2px; display: block; margin-bottom: 25px; }

.upload-area {
    background: #f2f2f7; border-radius: 25px; padding: 40px 20px;
    text-align: center; cursor: pointer; display: block; margin-bottom: 25px;
    border: 2px dashed transparent; transition: 0.3s;
}
.upload-area:hover { border-color: var(--primary); }
.upload-area p { font-weight: 800; color: var(--primary); font-size: 1.1rem; margin-bottom: 5px; }
input[type=file] { display: none; }

/* Editor Styles */
#editor-workspace { display: none; flex-direction: column; gap: 20px; }

.sig-creator { background: #fbfbfd; border: 1px solid var(--card-border); border-radius: 20px; padding: 20px; text-align: left; }
.tabs { display: flex; gap: 10px; margin-bottom: 15px; }
.tabs button { flex: 1; padding: 10px; border-radius: 12px; border: none; background: #e5e5ea; font-weight: 700; cursor: pointer; transition: 0.2s; color: var(--muted); }
.tabs button.active { background: var(--primary); color: #fff; }

.sig-panel { display: none; flex-direction: column; align-items: center; gap: 15px; }
.sig-panel.active { display: flex; }

#draw-pad { width: 100%; height: 150px; background: #fff; border: 2px dashed var(--card-border); border-radius: 12px; cursor: crosshair; touch-action: none; }

#type-input { width: 100%; padding: 15px; font-size: 1.5rem; border: 2px solid var(--card-border); border-radius: 12px; text-align: center; font-family: 'Dancing Script', cursive; }

.color-picker { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.color-circle { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-circle.active { border-color: var(--text); transform: scale(1.1); }

.apply-sig-btn { background: #1d1d1f; color: #fff; padding: 12px 24px; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; margin-top: 10px; width: 100%; }

.pdf-stage { width: 100%; background: #e5e5ea; padding: 10px; border-radius: 20px; position: relative; overflow: auto; display: flex; justify-content: center; }
.pdf-canvas-wrapper { position: relative; box-shadow: 0 4px 15px rgba(0,0,0,0.1); background: #fff; }

/* Draggable Signature */
.draggable-sig { 
    position: absolute; top: 50px; left: 50px; border: 2px dashed var(--primary); 
    cursor: grab; display: none; box-sizing: border-box;
    background: rgba(0, 122, 255, 0.05); min-width: 50px; min-height: 30px;
}
.draggable-sig:active { cursor: grabbing; }
.draggable-sig img { width: 100%; height: 100%; pointer-events: none; }
.resize-handle {
    position: absolute; bottom: -6px; right: -6px; width: 16px; height: 16px;
    background: var(--primary); border-radius: 50%; cursor: nwse-resize;
}
.delete-sig {
    position: absolute; top: -12px; right: -12px; width: 24px; height: 24px;
    background: #ff3b30; color: #fff; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px;
}

.pdf-controls { display: flex; justify-content: space-between; align-items: center; background: #f2f2f7; padding: 10px 20px; border-radius: 16px; margin-top: 15px; }
.pdf-controls button { background: #fff; border: 1px solid var(--card-border); padding: 8px 15px; border-radius: 10px; cursor: pointer; font-weight: 700; }

.page-settings { text-align: left; background: #fbfbfd; padding: 20px; border-radius: 20px; border: 1px solid var(--card-border); margin-top: 15px; }
.page-settings label { font-size: 0.8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; display: block; }
.page-settings select, .page-settings input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); font-size: 0.95rem; outline: none; margin-bottom: 10px; }

button.download-btn { width: 100%; padding: 18px; border: none; border-radius: 50px; font-weight: 800; font-size: 1rem; cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px; background: var(--primary); color: #fff; margin-top: 20px; }
button.download-btn:active { transform: scale(0.98); }

/* Guide & SEO Styles */
.guide-container { width: 75%; margin: 40px auto; padding: 60px 30px; background: rgba(255,255,255,0.7); border-radius: 45px; border: 1px solid #f0f0f0; backdrop-filter: blur(20px); text-align: left; }
.guide-container h2 { font-size: 2.2rem; font-weight: 900; color: var(--primary); margin-bottom: 25px; letter-spacing: -1.5px; }
.guide-container h3 { font-size: 1.4rem; font-weight: 800; margin: 35px 0 15px; border-left: 5px solid var(--primary); padding-left: 15px; }
.guide-container p { font-size: 1.1rem; line-height: 1.8; color: #444; margin-bottom: 20px; font-weight: 500; }
.guide-container ul { list-style: none; margin: 20px 0; }
.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); }

.faq-section { width: 75%; margin: 40px auto; padding: 0 15px; text-align: left; }
.faq-section h2 { font-size: 2.2rem; font-weight: 900; color: var(--primary); margin-bottom: 25px; text-align: center; letter-spacing: -1.5px; }
.faq-item { border-bottom: 1px solid var(--card-border); margin-bottom: 15px; }
.faq-question { width: 100%; background: none; border: none; text-align: left; padding: 15px 0; font-size: 1.1rem; font-weight: 700; cursor: pointer; position: relative; padding-right: 30px; color: var(--text); }
.faq-question::after { content: '+'; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 300; color: var(--primary); transition: transform 0.3s; }
.faq-item.active .faq-question::after { transform: translateY(-50%) rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; }
.faq-answer p { font-size: 1rem; line-height: 1.7; color: #444; padding: 0 0 20px; font-weight: 500; }

@media (max-width: 1024px) {
    .guide-container, .faq-section { width: 95%; }
}