/* Coin Master Pro — engagement layer (reading progress, sticky CTA, next-read) */

/* Reserve space when sticky quick-nav is visible so content isn’t hidden behind the bar */
body.cmp-sticky-cta-visible {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

/* Village calculator / lookup: easier taps, no double-tap zoom on iOS when font is small elsewhere */
.cmp-village-level-input {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.15);
}

#cmp-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9998;
    pointer-events: none;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, #2563eb, #7c3aed, #0891b2);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.45);
}

html.dark #cmp-reading-progress {
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #22d3ee);
    box-shadow: 0 0 14px rgba(96, 165, 250, 0.4);
}

#cmp-sticky-session-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 0.5rem 0.65rem calc(0.5rem + env(safe-area-inset-bottom, 0));
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(10px);
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.2);
}

#cmp-sticky-session-cta.is-visible {
    transform: translateY(0);
    opacity: 1;
}

#cmp-sticky-session-cta a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
    border: 1px solid rgba(96, 165, 250, 0.45);
    color: #e0f2fe;
    background: rgba(37, 99, 235, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease;
}

#cmp-sticky-session-cta a:hover {
    background: rgba(37, 99, 235, 0.55);
    border-color: #93c5fd;
}

.cmp-next-read {
    margin: 2rem 0 1.5rem;
    padding: 1.15rem 1.2rem 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border, #dbe4ff);
    background: linear-gradient(165deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.06) 100%);
}

html.dark .cmp-next-read {
    border-color: #334155;
    background: linear-gradient(165deg, rgba(96, 165, 250, 0.12) 0%, rgba(124, 58, 237, 0.08) 100%);
}

.cmp-next-read h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text, #172554);
}

html.dark .cmp-next-read h2 {
    color: var(--text, #f1f5f9);
}

.cmp-next-read-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .cmp-next-read-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cmp-next-read-grid li {
    margin: 0;
    padding: 0.75rem 0.85rem;
    border-radius: 0.75rem;
    background: var(--surface, rgba(255, 255, 255, 0.9));
    border: 1px solid var(--border, #e2e8f0);
}

html.dark .cmp-next-read-grid li {
    background: rgba(30, 41, 59, 0.85);
    border-color: #334155;
}

.cmp-next-read-grid a {
    font-weight: 800;
    font-size: 0.92rem;
    text-decoration: none;
    color: var(--primary, #2563eb);
}

.cmp-next-read-grid a:hover {
    text-decoration: underline;
}

.cmp-next-read-grid p {
    margin: 0.35rem 0 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--muted, #5b6685);
}

.cmp-toc {
    margin: 1rem 0 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border, #dbe4ff);
    background: var(--surface-soft, rgba(243, 244, 246, 0.95));
}

html.dark .cmp-toc {
    border-color: #334155;
    background: rgba(30, 41, 59, 0.65);
}

.cmp-toc strong {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted, #64748b);
    margin-bottom: 0.5rem;
}

.cmp-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.cmp-toc a {
    font-weight: 700;
    font-size: 0.88rem;
}

.cmp-calc-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cmp-calc-actions button {
    font: inherit;
    font-weight: 800;
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.cmp-calc-actions button:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}

html.dark .cmp-calc-actions button {
    border-color: #475569;
    background: #1e293b;
    color: #e2e8f0;
}

html.dark .cmp-calc-actions button:hover {
    border-color: #60a5fa;
    color: #93c5fd;
}

.cmp-calc-actions button.cmp-copied {
    border-color: #059669;
    color: #047857;
    background: #ecfdf5;
}

html.dark .cmp-calc-actions button.cmp-copied {
    border-color: #34d399;
    color: #6ee7b7;
    background: rgba(6, 78, 59, 0.35);
}

/* =============================================================================
   Future display ads (e.g. AdSense) — slots stay hidden until you integrate.
   Min width/height match common IAB sizes to limit CLS when display is enabled.
   To activate: remove display:none, set display:flex (or block) on the slot.
   ============================================================================= */
.ad-slot-leaderboard,
.ad-slot-rectangle,
.ad-slot-in-article {
    display: none !important;
    box-sizing: border-box;
    margin: 1.25rem auto;
    text-align: center;
    overflow: hidden;
}

.ad-slot-leaderboard {
    min-height: 90px;
    min-width: 320px;
    max-width: 728px;
    width: 100%;
}

.ad-slot-rectangle {
    min-height: 250px;
    min-width: 300px;
    max-width: 336px;
    width: 100%;
}

.ad-slot-in-article {
    min-height: 250px;
    min-width: 300px;
    max-width: min(100%, 336px);
    width: 100%;
}

/* Minimal site footer (legal links) — works on guide pages and next to hub styling */
.cmp-site-footer {
    margin-top: 1.75rem;
    padding: 1rem 0 0;
    border-top: 1px solid var(--border, #e2e8f0);
    text-align: center;
}

html.dark .cmp-site-footer {
    border-color: #334155;
}

.cmp-site-footer p {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--muted, #64748b);
}

.cmp-site-footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.cmp-site-footer a:hover {
    color: var(--primary, #2563eb);
}

html.dark .cmp-site-footer a:hover {
    color: #93c5fd;
}

/* Cookie consent — fixed bar, above sticky CTA z-index */
#cmp-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10050;
    padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

#cmp-cookie-banner .cmp-cookie-banner__inner {
    pointer-events: auto;
    max-width: 38rem;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
}

#cmp-cookie-banner .cmp-cookie-banner__text {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    flex: 1 1 11rem;
    color: #cbd5e1;
}

#cmp-cookie-banner .cmp-cookie-banner__btn {
    font: inherit;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 0.38rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.55);
    background: rgba(37, 99, 235, 0.5);
    color: #f8fafc;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#cmp-cookie-banner .cmp-cookie-banner__btn:hover {
    background: rgba(37, 99, 235, 0.72);
    border-color: #93c5fd;
}

body.cmp-cookie-banner-visible {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

body.cmp-sticky-cta-visible.cmp-cookie-banner-visible {
    padding-bottom: calc(5rem + 4.75rem + env(safe-area-inset-bottom, 0px));
}
