/* Tema Papiro — paleta e tipografia do Guia Tarot Iniciático
   Papel #efe6d2 · painel #f7f2e7 · tinta #3a3530 · dourado #c99a2e · tijolo #99463c */
body { background: var(--bg-gradient); background-color: var(--bg-color); font-size: 17px; line-height: 1.65; }
.star-bg { display: none; }
h1, h2, h3, h4, .modal-title { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; color: var(--text-color); letter-spacing: .01em; }
h1 { text-shadow: none; background: none; -webkit-text-fill-color: var(--text-color); color: var(--text-color); }
p, li, label, input, textarea, select, button { font-family: 'Source Serif 4', Georgia, serif; }
em, .subtitle, .reading-summary-text { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 1.08em; }

/* Painéis: papel claro com moldura dupla, como as caixas do guia */
.glass-panel, .modal-content, .stat-card, .new-task-card, .task-item, .history-item, .grimorio-card-item {
    background: var(--card-bg-solid); border: 1px solid var(--border-color);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: inset 0 0 0 4px var(--card-bg-solid), inset 0 0 0 5px rgba(143,127,94,.45);
}
.task-item, .history-item, .grimorio-card-item { box-shadow: none; }
.glass-panel::before { display: none; }
.modal-overlay { background: rgba(58,53,48,.55); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Título de seção com filete dourado */
.tab-content h2::after, .modal-title::after { content: ""; display: block; width: 28px; height: 3px; background: var(--gold); margin-top: 8px; }
.top-bar, .tabs-nav { border-color: rgba(143,127,94,.4); }
.top-bar, header { background: transparent; }
.brand-badge, .iniciatico-tag { background: none; border: 0; color: var(--text-dim); letter-spacing: .14em; }

/* Abas */
.tab-btn { color: var(--text-muted); background: transparent; border-radius: 0; }
.tab-btn:hover { color: var(--text-color); background: rgba(143,127,94,.1); }
.tab-btn.active { color: var(--text-color); background: transparent; border-bottom: 2px solid var(--accent-color); box-shadow: none; }

/* Botões */
.btn-primary { background: var(--accent-color); color: #f7f2e7; border: 1px solid var(--accent-hover); box-shadow: none; text-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: none; transform: none; }
.btn-gold { background: var(--gold); color: var(--text-color); border: 1px solid var(--gold-dark); box-shadow: none; }
.btn-gold:hover { background: var(--gold-light); box-shadow: none; }
.btn-secondary, .icon-btn, .chip, .filter-pill, .card-action-btn { background: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
.btn-secondary:hover, .icon-btn:hover, .chip:hover, .filter-pill:hover, .filter-pill.active { background: rgba(153,70,60,.08); border-color: var(--accent-color); color: var(--text-color); }

/* Campos */
input, textarea, select { background: #fbf8f0; color: var(--text-color); border: 1px solid var(--border-color); border-radius: 2px; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(153,70,60,.18); }
:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Cartas: verso (antes de virar) em tijolo com moldura dourada; face revelada em papel */
.card-face.front { background: #99463c; border: 1px solid #7f372f; box-shadow: inset 0 0 0 5px #99463c, inset 0 0 0 6px var(--gold), 0 2px 10px rgba(58,53,48,.22); }
.card-back-pattern { border-color: rgba(217,174,72,.6); }
.card-back-hint { color: #e6c36a; }
.card-face.back { background: #f7f2e7; border: 1px solid var(--text-dim); box-shadow: 0 2px 10px rgba(58,53,48,.18); }
.card-face.back.inverted { border-color: var(--danger); }
.card-inner-frame { border-color: rgba(143,127,94,.55); }
.card-name-title, .card-top-number { color: var(--text-color); }
.card-svg-container, .modal-card-svg, .grimorio-card-svg { color: var(--accent-color); }
.tab-content h2 { color: var(--text-color); background: none; -webkit-text-fill-color: var(--text-color); }

/* Avisos e marcadores */
.modal-section { background: rgba(143,127,94,.08); border-left: 3px solid var(--gold); }
.toast-notification { background: var(--text-color); color: #f7f2e7; border: 0; box-shadow: 0 4px 16px rgba(58,53,48,.3); }
.streak-badge, .level-badge { background: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
::selection { background: rgba(201,154,46,.35); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== Cartas da tiragem: botões nunca cortados ===== */
.card-wrapper { width: 200px; min-height: 440px; }
.tarot-card { min-height: 400px; }
.card-face.back div[style*="display: flex"], .card-face.back div:has(> .card-action-btn) { flex-wrap: wrap; gap: 4px; }
.card-face.back .card-action-btn { flex: 1 1 78px; width: auto; min-width: 0; margin-top: 4px; padding: 7px 4px; white-space: nowrap; font-size: .74rem; }
.card-meaning-text { overflow-wrap: anywhere; }

/* ===== Celular ===== */
@media (max-width: 768px) {
    body { font-size: 16px; padding: 8px 8px calc(48px + env(safe-area-inset-bottom)); }
    h1 { font-size: clamp(1.7rem, 7.4vw, 2.2rem); line-height: 1.15; }
    .subtitle { font-size: 1rem; line-height: 1.45; margin-top: 6px; }
    .top-bar { gap: 8px; }
    .brand-badge { font-size: .68rem; letter-spacing: .1em; }
    .top-actions { gap: 6px; }
    .streak-badge, .level-badge, .icon-btn, .user-profile-btn { font-size: .78rem; padding: 6px 10px; min-height: 36px; }

    /* Abas em faixa rolável, em vez de uma pilha de botões */
    .tabs-nav { display: flex; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; gap: 0; margin: 10px -8px 14px; padding: 0 8px;
        border-bottom: 1px solid var(--border-color); scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs-nav::-webkit-scrollbar { display: none; }
    .tab-btn { flex: 0 0 auto; white-space: nowrap; border: 0; border-bottom: 2px solid transparent; min-height: 44px; padding: 10px 14px; scroll-snap-align: start; }
    .tab-btn.active { border-bottom-color: var(--accent-color); }

    .glass-panel { padding: 16px 12px; box-shadow: inset 0 0 0 3px var(--card-bg-solid), inset 0 0 0 4px rgba(143,127,94,.4); }
    input, select, textarea { font-size: 16px; min-height: 44px; }
    .btn-primary, .btn-secondary, .btn-gold, .filter-pill, .chip { min-height: 44px; }
    .modal-content { width: calc(100% - 16px); max-height: 92vh; padding: 18px 14px; }

    /* Cartas: duas por linha */
    .spread-results { gap: 12px 8px; }
    .card-wrapper { width: calc(50% - 4px); min-width: 0; min-height: 430px; }
    .tarot-card { min-height: 390px; }
    .card-face { padding: 10px; }
    .card-name-title { font-size: 1.02rem; }
    .card-meaning-text { font-size: .8rem; padding: 6px; }
    .card-face.back .card-action-btn { flex-basis: 100%; }
}
@media (max-width: 380px) {
    .card-wrapper { width: 100%; max-width: 240px; }
}
.card-meaning-text { background: rgba(143,127,94,.12); }

/* ===== Carta com altura flexível: cresce com o conteúdo, nada escapa da moldura ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.card-wrapper { min-height: 0; }
.tarot-card { display: grid; min-height: 380px; }
.card-face { position: relative; grid-area: 1 / 1; height: auto; min-height: 100%; top: auto; left: auto; }
.card-face .card-inner-frame { flex: 1 1 auto; height: auto; }
@media (max-width: 768px) {
    .card-wrapper { min-height: 0; }
    .tarot-card { min-height: 360px; }
}

/* ===== Ilustrações do Tarot de Marselha ===== */
.carta-img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 2px 8px rgba(58,53,48,.28); user-select: none; -webkit-user-drag: none; }
.carta-fallback svg { width: 100%; height: 100%; }
.card-svg-container.card-art { width: 100%; height: auto; margin: 2px 0 6px; }
.card-svg-container.card-art .carta-img { width: auto; max-width: 100%; max-height: 340px; margin: 0 auto; }
.card-inner-frame:has(.card-art) { padding: 8px; }
.card-inner-frame:has(.card-art) .card-top-number { display: none; }
.grimorio-card-svg { width: 100%; max-width: 104px; height: auto; margin: 8px 0; }
.modal-card-svg { width: min(190px, 52vw); height: auto; margin: 0 auto 8px; }
.soul-card-svg { width: 54px; height: auto; }
.soul-card-svg .carta-img { border-radius: 3px; box-shadow: none; }


/* ========================================================
   AUTENTICAÇÃO — formulários, senha, regras, Google
   ======================================================== */
#profSectionAuth { --ok: #4f6b3a; }
#profSectionAuth .auth-toggle-btn { min-height: 44px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .form-group { gap: 6px; }
.auth-form label { font-size: .9rem; }
.auth-form input[type="text"], .auth-form input[type="email"],
.auth-form input[type="password"], .auth-form input[type="date"] {
    width: 100%; box-sizing: border-box; min-height: 48px; padding: 12px 14px;
    font-size: 16px; font-family: inherit; color: var(--text-color);
    background: #fbf8ef; border: 1px solid var(--border-color); border-radius: 10px;
    outline: none; transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
.auth-form input::placeholder { color: var(--text-muted); opacity: .7; }
.auth-form input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(201,154,46,.28); }
.auth-form input.is-invalid { border-color: var(--danger, #a33b32); }
.auth-hint { font-size: .78rem; color: var(--text-muted); margin: 0; line-height: 1.35; }

.pw-field { position: relative; display: flex; align-items: center; }
.auth-form .pw-field input { padding-right: 52px; }
.pw-toggle {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 8px; color: var(--text-muted); cursor: pointer;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--accent-color); background: rgba(153,70,60,.08); outline: none; }
.pw-toggle svg { width: 22px; height: 22px; }
.pw-toggle .icon-eye-off { display: none; }
.pw-field.is-visible .icon-eye { display: none; }
.pw-field.is-visible .icon-eye-off { display: block; }

.pw-rules {
    list-style: none; margin: -4px 0 0; padding: 10px 14px; display: grid; gap: 5px;
    font-size: .84rem; color: var(--text-muted);
    background: rgba(143,127,94,.08); border: 1px solid var(--border-color); border-radius: 10px;
}
.pw-rules li { display: flex; align-items: center; gap: 8px; transition: color .2s; }
.pw-rules li::before { content: '○'; width: 1.2em; text-align: center; }
.pw-rules li.ok { color: var(--ok); font-weight: 600; }
.pw-rules li.ok::before { content: '✓'; font-weight: 700; }
.pw-match { min-height: 1.1em; margin-top: -6px; }
.pw-match.ok { color: var(--ok); font-weight: 600; }
.pw-match.bad { color: var(--danger, #a33b32); font-weight: 600; }

#profSectionAuth .avatar-selection-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 2px; }
#profSectionAuth .avatar-radio { position: relative; padding: 0; background: none; border: 0; justify-content: center; border-radius: 50%; }
#profSectionAuth .avatar-radio input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#profSectionAuth .avatar-radio span {
    width: 100%; max-width: 52px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; border-radius: 50%; background: #fbf8ef; border: 1.5px solid var(--border-color); transition: all .2s;
}
#profSectionAuth .avatar-radio input:checked + span { border-color: var(--accent-color); background: rgba(153,70,60,.12); box-shadow: 0 0 0 3px rgba(153,70,60,.2); }
#profSectionAuth .avatar-radio input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 2px; }

.auth-google-btn {
    width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 10px;
    font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; transition: box-shadow .2s, background .2s;
}
.auth-google-btn:hover { background: #f8f9fa; box-shadow: 0 1px 4px rgba(60,64,67,.25); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: .8rem; color: var(--text-muted); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

.auth-link-btn {
    align-self: flex-end; min-height: 36px; padding: 4px 2px; background: none; border: 0;
    font: inherit; font-size: .85rem; color: var(--accent-color); text-decoration: underline; cursor: pointer;
}
.auth-msg { min-height: 1.2em; margin: 0; text-align: center; font-size: .86rem; line-height: 1.35; }
.auth-msg.erro { color: var(--danger, #a33b32); }
.auth-msg.ok { color: var(--ok); }
.auth-submit { width: 100%; min-height: 50px; }
.auth-footnote { text-align: center; font-size: .78rem; color: var(--text-muted); margin: 18px 0 0; line-height: 1.45; }
.auth-msg:empty { display: none; }
.auth-submit { font-size: .88rem; letter-spacing: .03em; gap: 8px; justify-content: center; text-align: center; }


/* ========================================================
   BOTÃO DE CONTA NO CABEÇALHO (Entrar / Criar conta)
   ======================================================== */
.user-profile-btn { order: -1; min-height: 44px; }
.user-guest-view, .user-logged-view { display: inline-flex; align-items: center; gap: 8px; }
.user-profile-btn.is-guest .user-logged-view { display: none; }
.user-profile-btn.is-logged .user-guest-view { display: none; }

.user-profile-btn.is-guest {
    padding: 8px 18px; background: var(--accent-color); color: #f7f2e7;
    border: 1px solid var(--accent-hover); font-weight: 700; letter-spacing: .02em;
    box-shadow: 0 2px 10px rgba(153,70,60,.35); animation: contaPulso 3s ease-in-out infinite;
}
.user-profile-btn.is-guest:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 3px 14px rgba(153,70,60,.5); }
.user-guest-icon { width: 20px; height: 20px; flex-shrink: 0; }

.user-profile-btn.is-logged .avatar-icon { position: relative; }
.user-profile-btn.is-logged .avatar-icon::after {
    content: ''; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px;
    background: #4f6b3a; border: 2px solid #f7f2e7; border-radius: 50%;
}

@keyframes contaPulso {
    0%, 100% { box-shadow: 0 2px 10px rgba(153,70,60,.35); }
    50% { box-shadow: 0 2px 10px rgba(153,70,60,.35), 0 0 0 6px rgba(201,154,46,.28); }
}
@media (prefers-reduced-motion: reduce) { .user-profile-btn.is-guest { animation: none; } }

@media (max-width: 640px) {
    .user-profile-btn.is-guest { flex: 1 0 100%; justify-content: center; font-size: .95rem; }
    .user-profile-btn.is-guest .user-guest-view { justify-content: center; }
}
.top-actions { flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.top-actions > * { white-space: nowrap; }
@media (max-width: 640px) { .top-actions { justify-content: center; } }
@media (min-width: 641px) {
    .top-bar { gap: 12px; }
    .brand-badge { flex: 1 1 180px; min-width: 0; letter-spacing: .08em; font-size: .72rem; }
    .top-actions { gap: 8px; flex: 0 1 auto; }
}


/* ===== Janelas pequenas (data de nascimento / nova senha) ===== */
.mini-dialog { --ok: #4f6b3a; max-width: 420px; padding: 28px 22px 22px; text-align: left; }
.mini-dialog h3 { margin: 0 0 8px; text-align: center; font-size: 1.35rem; }
.mini-dialog-text { margin: 0 0 18px; text-align: center; font-size: .92rem; color: var(--text-muted); line-height: 1.45; }

/* ===== Janela de confirmação ===== */
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.confirm-actions .btn-secondary, .confirm-actions .btn-primary { flex: 1; min-height: 48px; justify-content: center; }
.confirm-type-group input { width: 100%; box-sizing: border-box; min-height: 48px; padding: 12px 14px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 10px; background: #fbf8ef; text-transform: uppercase; letter-spacing: .08em; outline: none; }
.confirm-type-group input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(201,154,46,.28); }
.btn-danger-solid { background: #a33b32 !important; border-color: #8a2f27 !important; color: #fff !important; }
.btn-danger-solid:hover:not(:disabled) { background: #8a2f27 !important; }
#confirmOkBtn:disabled { opacity: .45; cursor: not-allowed; }
.confirm-actions > * { min-width: 0; white-space: normal; text-align: center; letter-spacing: .02em; font-size: .88rem; line-height: 1.2; }
@media (max-width: 480px) { .confirm-actions { flex-direction: column-reverse; } .confirm-actions > * { width: 100%; flex: none; } }

/* Camadas: janelas de confirmação/conta ficam acima da janela "Minha Conta"; avisos (toast) acima de tudo */
#confirmModal, #nascimentoModal, #novaSenhaModal { z-index: 1100; }
.toast-notification { z-index: 1300; }

/* Rodapé */
.site-footer { text-align: center; padding: 20px 16px 32px; font-size: .85rem; position: relative; z-index: 2; }
.site-footer a { color: var(--text-muted); text-decoration: underline; padding: 10px 8px; display: inline-block; }
.site-footer a:hover { color: var(--accent-color); }

#acessoModal { z-index: 1100; }
#acessoInput, #regCodigo { text-transform: uppercase; letter-spacing: .06em; }
