/* ===== Auth pop-up (auth-modal.js) =====
   Paper postcard, same values as levels-trail.css .no-journey-card and the
   homepage hero postcard: paper #FBF6EA, ink #2B1C50, muted #8A7A5A,
   gold #B7791F, rule #D8CDB2, purple #7C2BF5. Fonts: Baloo 2, Nunito Sans,
   Caveat (each page loads them). */
.am-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 10, 40, .55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.am-overlay[hidden] { display: none; }
body.am-open { overflow: hidden; }

.am-card {
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 26px 26px 22px;
    border-radius: 8px;
    background: #FBF6EA;
    color: #2B1C50;
    box-shadow: 0 20px 44px rgba(11,16,32,.35);
    rotate: -1deg;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    text-align: center;
}
.am-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: none;
    color: #8A7A5A;
    font-size: 18px;
    cursor: pointer;
}
.am-close:hover { background: rgba(0,0,0,.05); color: #2B1C50; }
.am-kicker {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    font-weight: 700;
    color: #B7791F;
    line-height: 1;
}
.am-title {
    margin: 6px 0 8px;
    font-family: 'Baloo 2', cursive;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
}
.am-sub {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    color: #8A7A5A;
}
.am-sub[hidden] { display: none; }

.am-tabs {
    display: flex;
    gap: 4px;
    margin: 0 auto 14px;
    padding: 4px;
    width: fit-content;
    border-radius: 12px;
    background: #F1E9D6;
}
.am-tab {
    border: none;
    border-radius: 9px;
    padding: 7px 18px;
    background: none;
    font-family: 'Baloo 2', cursive;
    font-size: 16px;
    font-weight: 800;
    color: #8A7A5A;
    cursor: pointer;
}
.am-tab.is-on { background: #fff; color: #2B1C50; box-shadow: 0 1px 0 #D8CDB2; }

.am-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.am-form[hidden] { display: none; }
.am-row { display: flex; gap: 10px; }
.am-row .am-field { flex: 1; min-width: 0; }
.am-field { display: flex; flex-direction: column; gap: 4px; }
.am-field span {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8A7A5A;
}
.am-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 2px solid #D8CDB2;
    border-radius: 10px;
    background: #fff;
    font: 600 15px 'Nunito Sans', system-ui, sans-serif;
    color: #2B1C50;
    outline: none;
}
.am-field input:focus { border-color: #7C2BF5; }

.am-msg { margin: 0; font-size: 13px; font-weight: 700; color: #C0392B; display: none; }
.am-msg.is-shown { display: block; }
#amResendMsg { color: #4E9E1E; }

.am-btn {
    margin-top: 4px;
    padding: 12px 22px;
    border: none;
    border-radius: 14px;
    background: #7C2BF5;
    color: #fff;
    font-family: 'Baloo 2', cursive;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,.2);
    transition: transform .15s, background .15s;
}
.am-btn:hover { background: #8F45FF; transform: translateY(-2px); }
.am-btn:disabled { opacity: .7; cursor: progress; transform: none; }
.am-btn:focus-visible, .am-tab:focus-visible, .am-close:focus-visible { outline: 3px solid #FBBF24; outline-offset: 3px; }

.am-link, .am-link-btn {
    align-self: center;
    border: none;
    background: none;
    font: 700 13px 'Nunito Sans', system-ui, sans-serif;
    color: #7C2BF5;
    text-decoration: none;
    cursor: pointer;
}
.am-link:hover, .am-link-btn:hover { text-decoration: underline; }

.am-sent[hidden] { display: none; }
.am-sent { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
.am-sent-icon { font-size: 40px; line-height: 1; }
.am-sent-text { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.5; }
.am-sent-hint { margin: 0; font-size: 12px; font-weight: 700; color: #8A7A5A; }

@media (max-width: 420px) {
    .am-card { padding: 22px 18px 18px; rotate: 0deg; }
    .am-row { flex-direction: column; }
    .am-title { font-size: 23px; }
}
