/* Manhatic Links — uses Manhatic tokens when available, sane fallbacks otherwise (Madara). */
.mhl-lock, .mhl-adfree, .mhl-pill, .mhl-toast {
	--mhl-primary: var(--mh-primary, #dc2626);
	--mhl-card: var(--card, #141414);
	--mhl-soft: var(--soft, #1f1f1f);
	--mhl-border: var(--border, #2a2a2a);
	--mhl-fg: var(--fg, #fafafa);
	--mhl-muted: var(--muted, #a3a3a3);
	--mhl-radius: var(--mh-radius, 12px);
	font-family: inherit;
}
.mhl-muted { color: var(--mhl-muted); }

/* Lock screen */
.mhl-lock { max-width: 560px; margin: 30px auto; padding: 30px 22px; text-align: center; border-radius: calc(var(--mhl-radius) * 1.4); background: var(--mhl-card); border: 1px solid var(--mhl-border); color: var(--mhl-fg); box-shadow: 0 20px 60px -30px rgba(0,0,0,.7); }
.mhl-lock__icon { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 99px; display: flex; align-items: center; justify-content: center; color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.mhl-lock__title { font-size: 21px; font-weight: 800; margin: 0 0 8px; color: var(--mhl-fg); }
.mhl-lock__text { color: var(--mhl-muted); margin: 0 0 14px; line-height: 1.8; }
.mhl-lock__timer { display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--mhl-soft); font-size: 14px; margin: 0 0 16px; }
.mhl-lock__note { font-size: 13px; color: var(--mhl-fg); margin: 14px 0 0; }
.mhl-lock__hint { font-size: 12px; color: var(--mhl-muted); margin: 10px 0 0; }
.mhl-gws { display: grid; gap: 10px; }
.mhl-gw { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; width: 100%; padding: 14px 16px; border-radius: var(--mhl-radius); background: var(--mhl-soft); border: 1px solid var(--mhl-border); color: var(--mhl-fg); text-align: start; cursor: pointer; font: inherit; transition: border-color .2s, transform .15s; }
.mhl-gw:hover { border-color: var(--mhl-primary); }
.mhl-gw:active { transform: scale(.99); }
.mhl-gw__name { font-weight: 700; font-size: 15px; }
.mhl-gw small { grid-column: 1; color: var(--mhl-muted); font-size: 12px; }
.mhl-gw__go { grid-row: 1 / span 2; grid-column: 2; padding: 8px 14px; border-radius: 10px; background: var(--mhl-primary); color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; }
.mhl-gw:disabled { opacity: .55; cursor: not-allowed; }
.mhl-gw.is-done .mhl-gw__go { background: #16a34a; }
.mhl-gw.is-loading .mhl-gw__go::after, .mhl-btn.is-loading::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-inline-start: 8px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 99px; animation: mhl-spin .7s linear infinite; vertical-align: -2px; }
@keyframes mhl-spin { to { transform: rotate(360deg); } }
.mhl-steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 16px; }
.mhl-steps i { width: 34px; height: 6px; border-radius: 9px; background: var(--mhl-soft); }
.mhl-steps i.is-done { background: #16a34a; }
.mhl-steps span { font-size: 13px; color: var(--mhl-muted); margin-inline-start: 6px; }

/* Madara chapter-list badges */
.mhl-badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; margin-inline-start: 6px; vertical-align: middle; }
.mhl-badge--lock { background: rgba(245, 158, 11, .15); color: #d97706; }
.mhl-badge--free { background: rgba(34, 197, 94, .15); color: #16a34a; }

/* Ad-free page */
.mhl-adfree { color: var(--mhl-fg); display: flex; flex-direction: column; gap: 22px; }
.mhl-adfree__hero { display: flex; gap: 26px; align-items: center; padding: 24px; border-radius: calc(var(--mhl-radius) * 1.4); background: linear-gradient(135deg, color-mix(in srgb, var(--mhl-primary) 18%, var(--mhl-card)), var(--mhl-card)); border: 1px solid var(--mhl-border); }
.mhl-adfree__ring { position: relative; width: 150px; height: 150px; flex: none; }
.mhl-adfree__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mhl-ring-bg { fill: none; stroke: var(--mhl-soft); stroke-width: 10; }
.mhl-ring-fg { fill: none; stroke: var(--mhl-primary); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset .6s; }
.mhl-adfree.is-active .mhl-ring-fg { stroke: #22c55e; }
.mhl-adfree__time { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.mhl-adfree__time b { font-size: 26px; font-weight: 800; direction: ltr; }
.mhl-adfree__time span { font-size: 11px; color: var(--mhl-muted); max-width: 100px; }
.mhl-adfree__intro h2 { margin: 0 0 8px; font-size: 24px; color: var(--mhl-fg); }
.mhl-adfree__intro p { margin: 0 0 6px; color: var(--mhl-muted); line-height: 1.8; }
.mhl-adfree__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mhl-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--mhl-radius); background: var(--mhl-card); border: 1px solid var(--mhl-border); }
.mhl-card.is-off { opacity: .6; }
.mhl-card__plus { width: 64px; height: 64px; flex: none; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, #22c55e 15%, transparent); color: #22c55e; font-weight: 800; font-size: 20px; line-height: 1.1; }
.mhl-card__plus small { font-size: 10px; font-weight: 600; }
.mhl-card__body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mhl-card__body span { font-size: 12.5px; color: var(--mhl-muted); }
.mhl-card__body em { font-style: normal; font-size: 11.5px; color: var(--mhl-muted); }
.mhl-btn { padding: 10px 16px; border-radius: 10px; border: 0; background: var(--mhl-primary); color: #fff; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.mhl-btn:disabled { background: var(--mhl-soft); color: var(--mhl-muted); cursor: not-allowed; white-space: normal; max-width: 140px; font-size: 12px; line-height: 1.5; }
.mhl-adfree__rules { margin: 0; padding: 14px 18px 14px 18px; padding-inline-start: 34px; border-radius: var(--mhl-radius); background: var(--mhl-card); border: 1px dashed var(--mhl-border); color: var(--mhl-muted); font-size: 13px; line-height: 2; }

/* Pill */
.mhl-pill { position: fixed; z-index: 90; inset-block-end: 18px; inset-inline-start: 18px; display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px; background: var(--mhl-card); border: 1px solid var(--mhl-border); color: var(--mhl-fg) !important; font-size: 13px; font-weight: 700; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); text-decoration: none !important; }
.mhl-pill.is-on { border-color: #16a34a; }
.mhl-pill b { font-variant-numeric: tabular-nums; direction: ltr; color: #22c55e; }
body.mh-reading .mhl-pill { inset-block-end: 80px; opacity: .85; }

/* Sticky ad */
.mhl-sticky { position: fixed; z-index: 80; inset-inline: 0; inset-block-end: 0; display: flex; justify-content: center; padding: 6px; background: rgba(0,0,0,.75); }
.mhl-sticky__x { position: absolute; inset-block-start: -26px; inset-inline-end: 8px; width: 26px; height: 26px; border-radius: 99px; border: 0; background: #000; color: #fff; cursor: pointer; }
.mhl-slot { display: flex; justify-content: center; max-width: 100%; overflow: hidden; margin: 10px auto; }
.mhl-slot--between { margin: 8px auto; }
.mh-reader[data-mode="single"] .mhl-slot--between, .mh-reader[data-mode="double"] .mhl-slot--between { display: none; }

.mhl-toast { position: fixed; z-index: 9999; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: #111; color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: .3s; max-width: 92vw; }
[dir="rtl"] .mhl-toast { transform: translateX(50%); }
.mhl-toast.is-error { background: #b91c1c; }
.mhl-toast.is-out { opacity: 0; }

@media (max-width: 640px) {
	.mhl-pill { inset-block-end: 12px; inset-inline-start: 12px; padding: 7px 12px; font-size: 12px; }
	body.mh-reading .mhl-pill:not(.is-on) { display: none; }
	body.mh-reading .mhl-pill.is-on { inset-block-end: 12px; }
	.mhl-adfree__hero { flex-direction: column; text-align: center; }
	.mhl-adfree__list { grid-template-columns: 1fr; }
}
