:root {
    --primary: #0056b3; /* Darkened for WCAG AA contrast against white */
    --bg: #ffffff;
    --text: #1d1d1f;
    --muted: #555555; /* Darkened for WCAG AA contrast against white */
    --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: 95%; 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% } }

/* Disable Heavy Animation for Mobile Devices */
@media (max-width: 768px) {
    .rainbow-wrapper { animation: none !important; background-position: center !important; }
}

.glass-card { background: #fff; border-radius: 40px; padding: 35px 25px; 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; }

.editor { 
    width: 100%; border: 1.5px solid var(--card-border); 
    border-radius: 20px; padding: 15px; font-size: 1rem; outline: none; 
    background: #fbfbfd; font-family: 'Inter', sans-serif; 
    margin-bottom: 10px; transition: 0.3s; line-height: 1.5; resize: vertical;
}
.editor:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(0,122,255,0.1); }

.stats { font-size: 0.75rem; color: var(--muted); font-weight: 700; display: flex; gap: 15px; justify-content: flex-end; margin-bottom: 20px; }

/* Side-by-Side Grid */
.io-grid { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 768px) {
    .io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; align-items: start; }
    .editor { height: 320px !important; } /* Taller on desktop */
}
.io-col { display: flex; flex-direction: column; position: relative; }
.io-label { text-align: left; margin-bottom: 8px; font-size: 0.8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Controls Bar */
.controls-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; margin-top: 20px; background: #f5f5f7; padding: 15px; border-radius: 20px; }

.settings-group { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.cb-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text); cursor: pointer; margin: 0; text-transform: none; }
.cb-label input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; }

.repeat-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.small-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); }

.count-input { width: 80px; padding: 10px; border-radius: 10px; border: 1px solid var(--card-border); font-size: 0.9rem; font-weight: 700; outline: none; text-align: center; background: #fff; }
.count-input:focus { border-color: var(--primary); }

.btn { padding: 14px; border-radius: 14px; border: none; font-weight: 800; cursor: pointer; font-size: 0.85rem; transition: 0.3s; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-blue { background: var(--primary); color: white; }
.btn-dark { background: #1d1d1f; color: white; }
.btn-whatsapp { background: #0c8a41; color: white; } /* Darkened green for contrast */
.btn-outline { background: #fff; border: 1.5px solid #e5e5ea; color: var(--text); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.btn:active { transform: scale(0.96); }

.action-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; justify-content: center; }
.action-grid .btn { flex: 1; min-width: auto; padding: 10px 15px; font-size: 0.8rem; }

.overlay-btns { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; }
.clear-btn { background: rgba(0,0,0,0.05); border: none; padding: 6px 12px; border-radius: 8px; font-size: 0.7rem; font-weight: 700; cursor: pointer; color: #555; backdrop-filter: blur(5px); transition: 0.2s; }
.clear-btn:hover { background: #d1d1d6; color: #111; }

.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; text-align: center; }
.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); }

.disclaimer { padding: 40px; text-align: center; font-size: 0.75rem; color: #999; font-weight: 600; line-height: 1.6; }

.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; }
details.faq-item { border-bottom: 1px solid var(--card-border); margin-bottom: 15px; }
summary.faq-question { list-style: none; 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); outline: none; }
summary.faq-question::-webkit-details-marker { display: none; }
summary.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; }
details[open] summary.faq-question::after { content: '−'; transform: translateY(-50%); }
.faq-answer p { font-size: 1rem; line-height: 1.7; color: #444; padding: 5px 0 20px; margin: 0; font-weight: 500; }

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

/* Toast */
#toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 8px; padding: 16px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 15px; }
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }
