/* assets/sigilizador.css
   Frontend de criação em [sigilizador]. Paleta: branco/preto/amarelo (#ffd600). */

/* CRÍTICO: o atributo HTML `hidden` precisa ter prioridade sobre as regras
   display:flex/grid abaixo. Sem isso, o overlay .czsig-ritual (com
   position:fixed inset:0) fica sempre visível e captura todos os clicks
   na página, mesmo quando o usuário ainda está na etapa de digitar intento. */
.czsig-step[hidden],
.czsig-ritual[hidden],
.czsig-result[hidden],
.czsig-modal[hidden],
.czsig-error[hidden],
.czsig-planet-grid[hidden] { display: none !important; }

.czsig-app {
    max-width: 760px;
    width: 100%;
    margin: 32px auto;
    color: #111;
    font-family: inherit;
    box-sizing: border-box;
}

.czsig-app h1 { font-size: 1.8rem; margin-bottom: 8px; color: #111; }
.czsig-app h2 { font-size: 1.4rem; margin-bottom: 16px; color: #111; }
.czsig-app h3 { font-size: 1.05rem; margin: 16px 0 8px; color: #111; }
.czsig-intro {
    color: #444; margin-bottom: 24px; font-size: 1rem; line-height: 1.5;
    text-align: center;
}

.czsig-step {
    background: #fff;
    margin-bottom: 16px;
}
.czsig-step label {
    display: block; font-weight: 700; margin-bottom: 12px; color: #111;
    font-size: 1rem;
}

.czsig-counters {
    display: flex; gap: 24px; margin-top: 12px; font-size: 0.9rem; color: #666;
    flex-wrap: wrap;
}
.czsig-counter { display: inline-flex; align-items: center; gap: 4px; }
.czsig-counter strong {
    color: #111; min-width: 1ch; display: inline-block; font-weight: 800;
    font-size: 1rem;
}
.czsig-counter.is-ok strong { color: #16a34a; }

.czsig-actions {
    display: flex; gap: 10px; margin-top: 20px;
    flex-direction: column; align-items: stretch;
}
.czsig-actions .czsig-btn { width: 100%; }

/* Botões */
.czsig-btn {
    padding: 12px 20px; border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.12);
    background: #fff; color: #111; cursor: pointer; font-family: inherit;
    font-size: 0.95rem; font-weight: 700; transition: all 0.15s;
    line-height: 1.2;
}
.czsig-btn:hover:not(:disabled) {
    background: #fafafa; border-color: rgba(0,0,0,0.3);
    transform: translateY(-1px);
}
.czsig-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.czsig-btn-primary {
    background: #ffd600; border-color: #ffd600; color: #111;
}
.czsig-btn-primary:hover:not(:disabled) {
    background: #ffea4d; border-color: #ffea4d;
}
.czsig-btn-secondary {
    background: #fff;
}
.czsig-btn-link {
    background: transparent; border: 0; color: #111;
    text-decoration: underline; padding: 8px 0;
}
.czsig-btn-link:hover:not(:disabled) { color: #ffd600; }

/* Botão de confirmação após tornar público — verde discreto.
   Substitui dinamicamente o #czsig-make-public depois de bem-sucedido.
   É um <a> que linka pro sigilo público. */
.czsig-btn-published {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1b5e20;
    text-decoration: none;
    text-align: center;
    display: block;
    padding: 10px 16px;
    box-sizing: border-box;
}
.czsig-btn-published:hover {
    background: #c8e6c9; border-color: #66bb6a;
    color: #1b5e20; text-decoration: none;
}
.czsig-btn-published strong { font-weight: 800; display: block; }
.czsig-btn-published span { font-size: 0.78rem; opacity: 0.75; }

/* Otimizar esmaecido quando saldo < opt_cost (ainda clicável,
   mas o handler bate cedo com showError). */
.czsig-btn.is-no-credits {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Aviso/CTA "Sem créditos" — substitui o botão "Escolher técnica"
   quando user_credits < CZSIG_COST. Visualmente parece com um
   .czsig-btn-link mas mais destacado. */
.czsig-no-credits {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 20px;
    border-radius: 14px;
    background: #fff8c5;
    border: 1px solid #ffd600;
    color: #111;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.czsig-no-credits:hover,
.czsig-no-credits:focus {
    background: #ffd600;
    border-color: #ffd600;
    color: #111;
    text-decoration: none;
    transform: translateY(-1px);
}
.czsig-no-credits-cta {
    text-decoration: underline;
}

/* Mobile: padding menor */
@media (max-width: 540px) {
    .czsig-step { padding: 20px; }
}

/* Grid de técnicas */
.czsig-tech-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin: 12px 0;
}
.czsig-tech-card {
    padding: 24px 16px; border-radius: 16px; background: #fafafa;
    border: 2px solid transparent; cursor: pointer;
    display: flex; flex-direction: column; gap: 6px;
    align-items: center; text-align: center; color: #111;
    transition: all 0.15s; font-family: inherit;
}
.czsig-tech-card:hover, .czsig-tech-card.active {
    border-color: #ffd600; background: #fff8c5;
}
.czsig-tech-icon { font-size: 1.8rem; }
.czsig-tech-name { font-weight: 700; }
.czsig-tech-desc { font-size: 0.78rem; color: #666; }

/* Sub-grid de planetas */
.czsig-planet-grid { margin-top: 16px; }
.czsig-planets {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.czsig-planet-card {
    padding: 12px; background: #fafafa; border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px; cursor: pointer; color: #111; font-family: inherit;
    text-align: left; transition: all 0.15s;
}
.czsig-planet-card:hover, .czsig-planet-card.active {
    background: #fff8c5; border-color: #ffd600;
}
.czsig-planet-name { display: block; font-weight: 700; }
.czsig-planet-kamea {
    font-weight: 600; color: #666; font-size: 0.78rem;
    margin-left: 4px; letter-spacing: 0.02em;
}
.czsig-planet-domain { display: block; font-size: 0.72rem; color: #666; }

/* Modo "apenas sigilo": esconde o diagrama de fundo no SVG da tela */
.czsig-result.is-only-sigilo .czsig-diagram-bg { display: none; }

/* Controles de visualização (smoothing + espessura) */
.czsig-stroke-control {
    margin-top: 20px; padding: 16px; background: #fafafa;
    border-radius: 12px; border: 1px solid rgba(0,0,0,0.06);
    text-align: left;
}
.czsig-stroke-control .czsig-toggles-row {
    display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px;
}
.czsig-stroke-control .czsig-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; font-weight: 600;
    color: #111; font-size: 0.9rem;
}
.czsig-stroke-control .czsig-toggle input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: #ffd600; cursor: pointer;
}
.czsig-stroke-control .czsig-stroke-label {
    display: block; font-weight: 600; margin-bottom: 8px; color: #111;
    font-size: 0.9rem;
}
.czsig-stroke-control strong { color: #111; font-weight: 800; }
.czsig-stroke-control input[type="range"] {
    width: 100%; accent-color: #ffd600;
}

/* Linha do slider de ângulo de espelhamento — só aparece quando "Espelhar" on */
.czsig-mirror-angle-row { margin-bottom: 12px; }

/* Indicador de estado do transform: "Modificado…" → "Salvando…" → "✓ Salvo" */
.czsig-transform-status {
    margin: 8px 0 0; padding: 0; font-size: 0.78rem;
    color: #888; font-style: italic;
}

/* Preview SVG com transform-origin centralizado pra reflexão correta.
   Aplicado em .czsig-result-svg via JS (style inline) — fallback aqui. */
.czsig-result-svg {
    transform-origin: 50% 50%;
    transition: transform 80ms ease-out;
}

/* Textarea de intento */
#czsig-intent {
    width: 100%; padding: 16px; border-radius: 14px; background: #fff;
    color: #111; border: 2px solid rgba(0,0,0,0.12); font-family: inherit;
    font-size: 1.05rem; line-height: 1.5; box-sizing: border-box;
    resize: vertical; min-height: 90px;
    transition: border-color 0.15s;
}
#czsig-intent:focus {
    outline: none; border-color: #ffd600;
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.25);
}
#czsig-intent::placeholder { color: #999; }

/* Animação ritual — inline dentro do card, com altura mínima pra
   o .terco do tema não colapsar enquanto roda. Fundo branco do card
   (mesmo do tema), texto preto, mantra em destaque amarelo. */
.czsig-ritual {
    display: flex; align-items: center; justify-content: center;
    min-height: 480px; padding: 24px 16px; box-sizing: border-box;
}
.czsig-ritual-stage {
    text-align: center; max-width: 600px; color: #111; width: 100%;
}
.czsig-ritual-intent,
.czsig-ritual-letters,
.czsig-ritual-mantra {
    font-size: 1.15rem; margin: 12px 0; opacity: 0;
    transition: opacity 0.6s; color: #111;
}
.czsig-ritual-intent.visible,
.czsig-ritual-letters.visible,
.czsig-ritual-mantra.visible { opacity: 1; }
.czsig-ritual-intent  { font-style: italic; color: #555; }
.czsig-ritual-letters { letter-spacing: 0.18em; font-weight: 800; font-size: 1.3rem; }
.czsig-ritual-mantra  {
    font-style: italic; font-weight: 700;
    background: #fff8c5; color: #111; display: inline-block;
    padding: 6px 14px; border-radius: 999px;
}
.czsig-ritual-svg {
    width: 280px; height: 280px;
    margin-top: 8px;
    /* opacity controlada por JS (animateSvgDraw injeta inline). */
}

/* Tela de resultado */
.czsig-result { text-align: center; }
.czsig-result-intent {
    color: #555; font-size: 1rem; font-style: italic;
    margin: 0 auto 12px; max-width: 540px; line-height: 1.45;
}
.czsig-result-intent::before { content: '\201C'; margin-right: 2px; }
.czsig-result-intent::after  { content: '\201D'; margin-left: 2px; }
.czsig-result-letters {
    color: #111; font-size: 1.15rem;
    letter-spacing: 0.06em; margin: 8px 0 4px;
    word-spacing: 0.2em;
}
.czsig-result-image {
    display: inline-block; background: #fff;
    border-radius: 18px; margin: 8px 0;
}
.czsig-result-svg { width: 100%; aspect-ratio: 1 / 1;}
.czsig-result-mantra {
    font-size: 1.4rem; font-weight: 800; letter-spacing: 0.18em;
    color: #111; margin: 4px 0 12px; word-spacing: 0.3em;
    text-transform: uppercase;
}

.czsig-error {
    background: #ffd7d8; color: #7f1d1d; padding: 14px 16px;
    border-radius: 12px; margin: 16px 0; border: 1px solid #fca5a5;
}

.czsig-login-cta {
    text-align: center; padding: 48px 24px;
    background: #fafafa; border: 1px solid rgba(0,0,0,0.08); border-radius: 18px;
}
.czsig-login-cta a {
    display: inline-block; margin-top: 12px;
    background: #ffd600; color: #111; padding: 10px 20px; border-radius: 14px;
    text-decoration: none; font-weight: 700;
}
.czsig-login-cta a:hover { background: #ffea4d; }

/* ============================================================
   Estilizar com IA
   ============================================================ */

.czsig-stylize-action {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.czsig-stylize-action .czsig-btn {
    margin: 0 auto;
}
.czsig-stylize-hint {
    font-size: 0.75rem;
    color: #666;
    margin: 6px auto 0;
    max-width: 380px;
    line-height: 1.4;
}

/* Compare view — 2 sigilos stacked após estilizar */
.czsig-stylize-compare {
    margin-top: 16px;
}
.czsig-stylize-row {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.czsig-stylize-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.czsig-stylize-label {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    margin: 0 0 8px;
}
.czsig-stylize-image {
    display: inline-block;
    background: #fff;
    border-radius: 18px;
    margin: 0 0 12px;
    padding: 0;
}
.czsig-stylize-image svg {
    width: 320px;
    aspect-ratio: 1 / 1;
    display: block;
}
.czsig-stylize-row .czsig-btn {
    display: inline-block;
    min-width: 220px;
}
