/*
 * AnimeAV1 theme over the pages it does not draw itself (member area,
 * community, W2G, requests, guides, public profiles…). They keep their
 * AnimeFLV markup, scripts and layout sheets; av1-legacy-dark.css (generated
 * by scripts/build-theme-animeav1-legacy.mjs) recolours those sheets onto the
 * theme palette, and this file hand-tunes the shared pieces into the AV1
 * look: buttons → btn-main / btn-line, fields → .av1-field, pill tabs,
 * titles, the pager, alerts.
 *
 * Selectors use the generated file's pattern — `body.av1-legacy X` kept off
 * the theme shell with :not(.av1-shell):not(.av1-shell *) — so, loaded after
 * it, they win at equal strength without !important. `S` below stands for
 * that pair of :not()s.
 */
body.av1-legacy { background: rgb(var(--body)) !important; color: rgb(var(--subs)); }
body.av1-legacy .av1-body.Body { padding-top: 1rem; }

/* ── Titles: AV1 headings are bold, lead, no negative tracking ── */
body.av1-legacy :is(.WdgtCn > .Top .Title, .Title.Page h1, .Title.Page, .af-FoldTitle, .Wdgt .Top strong):not(.av1-shell):not(.av1-shell *) {
    color: rgb(var(--lead)); letter-spacing: 0; font-weight: 700;
}
body.av1-legacy .Title.Page:not(.av1-shell):not(.av1-shell *) h1 { font-size: 1.5rem; }

/* ── Boxes: the AV1 card (mute, line border, rounded) ── */
body.av1-legacy :is(.WdgtCn, .Wdgt):not(.av1-shell):not(.av1-shell *) {
    border: 1px solid rgb(var(--line)); border-radius: .75rem; box-shadow: none;
}

/* ── Buttons ── */
body.av1-legacy :is(button.StylB, .Button.StylB, a.StylB):not(.av1-shell):not(.av1-shell *) {
    background-color: rgb(var(--main)); color: rgb(var(--fore)); border: 0; border-radius: .5rem;
    text-transform: none; font-weight: 700; letter-spacing: 0; opacity: 1;
}
body.av1-legacy :is(button.StylB, .Button.StylB, a.StylB):not(.av1-shell):not(.av1-shell *):hover { opacity: 1; filter: brightness(.93); color: rgb(var(--fore)); }
body.av1-legacy :is(button.StylB, .Button.StylB):not(.av1-shell):not(.av1-shell *):disabled { opacity: .5; filter: none; }
body.av1-legacy :is(button.StylA, .Button.StylA, a.StylA):not(.av1-shell):not(.av1-shell *) {
    background-color: rgb(var(--line)); color: rgb(var(--subs)); border: 1px solid transparent; border-radius: .5rem;
    text-transform: none; font-weight: 700; letter-spacing: 0;
}
body.av1-legacy :is(button.StylA, .Button.StylA, a.StylA):not(.av1-shell):not(.av1-shell *):hover { background-color: rgb(var(--edge)); color: rgb(var(--lead)); border-color: transparent; }
body.av1-legacy .Button.StylC:not(.av1-shell):not(.av1-shell *) { background-color: rgb(var(--main) / .12); color: rgb(var(--main)); border-radius: .5rem; font-weight: 600; }
body.av1-legacy .Button.StylC:not(.av1-shell):not(.av1-shell *):hover { background-color: rgb(var(--main)); color: rgb(var(--fore)); }
body.av1-legacy .Button.Sm:not(.av1-shell):not(.av1-shell *) { text-transform: none; }
body.av1-legacy :is(.LogOut, .af-AccOut):not(.av1-shell):not(.av1-shell *) { border-radius: .5rem; text-transform: none; }

/* ── Fields: .av1-field ── */
body.av1-legacy :is(input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=date], input:not([type]), textarea, select):not(.av1-shell):not(.av1-shell *) {
    background-color: rgb(var(--soft)); border: 1px solid rgb(var(--line)); color: rgb(var(--lead));
    border-radius: .5rem; box-shadow: none;
}
body.av1-legacy :is(input, textarea, select):not(.av1-shell):not(.av1-shell *):focus { border-color: rgb(var(--main) / .6); outline: none; box-shadow: none; }
body.av1-legacy :is(input, textarea):not(.av1-shell):not(.av1-shell *)::placeholder { color: rgb(var(--text)); opacity: 1; }
body.av1-legacy :is(input, textarea):not(.av1-shell):not(.av1-shell *):disabled { opacity: .6; }

/* ── Pill tabs (AnimeFLV .Order / .af-Order, the community & W2G tab rows) ── */
body.av1-legacy :is(.Order, .af-Order) :is(a, span, button):not(.av1-shell):not(.av1-shell *) { border-radius: .5rem; text-transform: none; }
body.av1-legacy :is(.Order, .af-Order) :is(a, span, button):not(.av1-shell):not(.av1-shell *):is(.active, .Active, .on, [aria-current]) {
    background-color: rgb(var(--main)); color: rgb(var(--fore));
}
body.av1-legacy :is(.Order, .af-Order) :is(a, span, button):not(.av1-shell):not(.av1-shell *):is(.active, .Active, .on, [aria-current])::after { display: none; }

/* ── Pager (Bootstrap 3 .pagination) ── */
body.av1-legacy .pagination:not(.av1-shell):not(.av1-shell *) > li > :is(a, span) {
    border: 0; border-radius: .5rem !important; margin: 0 .15rem; background-color: rgb(var(--line)); color: rgb(var(--subs)); font-weight: 700;
}
body.av1-legacy .pagination:not(.av1-shell):not(.av1-shell *) > :is(.active, li:hover) > :is(a, span) { background-color: rgb(var(--main)); color: rgb(var(--fore)); }

/* ── Alerts (.Msj, Bootstrap .alert) ── */
body.av1-legacy :is(.Msj, .alert):not(.av1-shell):not(.av1-shell *) { border-radius: .5rem; border: 1px solid rgb(var(--line)); }
body.av1-legacy :is(.Msj.Wrn, .alert-warning):not(.av1-shell):not(.av1-shell *) { background-color: rgb(var(--warn) / .08); border-color: rgb(var(--warn) / .25); color: rgb(var(--warn)); }
body.av1-legacy :is(.Msj.Err, .alert-danger):not(.av1-shell):not(.av1-shell *) { background-color: rgb(239 68 68 / .12); border-color: rgb(239 68 68 / .35); color: #f87171; }
body.av1-legacy :is(.Msj.Scs, .alert-success):not(.av1-shell):not(.av1-shell *) { background-color: rgb(16 185 129 / .12); border-color: rgb(16 185 129 / .35); color: #34d399; }
body.av1-legacy :is(.alert-info):not(.av1-shell):not(.av1-shell *) { background-color: rgb(var(--main) / .1); border-color: rgb(var(--main) / .3); color: rgb(var(--main)); }

/* ── Bootstrap modals and drop-downs on these pages ── */
body.av1-legacy :is(.modal-content, .modal .Sect, .dropdown-menu):not(.av1-shell):not(.av1-shell *) { border: 1px solid rgb(var(--line)); border-radius: .75rem; box-shadow: 0 16px 36px #0008; }
body.av1-legacy .dropdown-menu:not(.av1-shell):not(.av1-shell *) > li > a:hover { background-color: rgb(var(--soft)); color: rgb(var(--lead)); }

/* ── Links inside text keep the theme accent ── */
body.av1-legacy :is(.af-Copy, .af-Note, .Description) a:not(.av1-shell):not(.av1-shell *) { color: rgb(var(--main)); }

/* ── Member area frame (themes/animeav1/views/frontend/member/layout):
      the reference's account page — header row, underlined tabs, panels ── */
body.av1-legacy .av1-acct { padding-top: .75rem; padding-bottom: 2rem; }
body.av1-legacy .av1-acct-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
body.av1-legacy .av1-acct-av { position: relative; display: block; flex: none; width: 5rem; height: 5rem; }
body.av1-legacy .av1-acct-av img { width: 5rem; height: 5rem; border-radius: 999px; object-fit: cover; border: 2px solid rgb(var(--line)); }
body.av1-legacy .av1-acct-av .fa { position: absolute; right: -.15rem; bottom: -.15rem; display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: 999px; background: rgb(var(--main)); color: rgb(var(--fore)); font-size: .8rem; }
body.av1-legacy .av1-acct-av .fa::before { font-family: FontAwesome; }
body.av1-legacy .av1-acct-who { flex: 1 1 16rem; min-width: 0; }
body.av1-legacy .av1-acct-who h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; font-weight: 700; color: rgb(var(--lead)); }
body.av1-legacy .av1-acct-name { margin: .25rem 0 0; font-size: .875rem; color: rgb(var(--subs)); }
body.av1-legacy .av1-acct-name strong { color: rgb(var(--lead)); }
body.av1-legacy .av1-acct-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .4rem 0 0; padding: 0; list-style: none; font-size: .8125rem; color: rgb(var(--text)); }
body.av1-legacy .av1-acct-meta .fa { margin-right: .35rem; color: rgb(var(--main)); }
body.av1-legacy .av1-acct-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
body.av1-legacy .av1-acct-actions .btn:not(.av1-shell):not(.av1-shell *) { display: inline-flex; align-items: center; gap: .4rem; height: 2.25rem; padding: 0 .9rem; font-size: .8125rem; font-weight: 600; line-height: 1; border-radius: .5rem; border: 1px solid rgb(var(--line)); background: transparent; color: rgb(var(--subs)); box-shadow: none; }
body.av1-legacy .av1-acct-actions .btn:not(.av1-shell):not(.av1-shell *):hover { border-color: rgb(var(--edge)); color: rgb(var(--lead)); }
body.av1-legacy .av1-acct-tabs { position: relative; display: flex; align-items: stretch; margin: 1.25rem 0 1.5rem; border-bottom: 1px solid rgb(var(--line)); overflow-x: auto; scrollbar-width: none; }
body.av1-legacy .av1-acct-tabs::-webkit-scrollbar { display: none; }
body.av1-legacy .av1-acct-tab:not(.av1-shell):not(.av1-shell *) { position: relative; flex: none; display: block; padding: 1rem 1rem 1.1rem; font-size: .875rem; font-weight: 500; line-height: 1.2; white-space: nowrap; color: rgb(var(--subs)); background: none; border: 0; border-radius: 0; text-transform: none; }
body.av1-legacy .av1-acct-tab:not(.av1-shell):not(.av1-shell *):hover { color: rgb(var(--lead)); }
body.av1-legacy .av1-acct-tab.is-active:not(.av1-shell):not(.av1-shell *) { color: rgb(var(--lead)); font-weight: 700; }
body.av1-legacy .av1-acct-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgb(var(--main)); }
body.av1-legacy .av1-acct-out { margin: 0 0 0 auto; display: flex; }
body.av1-legacy .av1-acct-out .av1-acct-tab:not(.av1-shell):not(.av1-shell *) { color: rgb(var(--text)); }
body.av1-legacy .av1-acct-out .av1-acct-tab:not(.av1-shell):not(.av1-shell *):hover { color: #f87171; }
body.av1-legacy .av1-acct-out .fa::before { font-family: FontAwesome; }
body.av1-legacy .av1-acct .av1-acct-main { float: none; width: auto; margin: 0; padding: 0; max-width: none; }
@media (max-width: 639px) {
    body.av1-legacy .av1-acct-head { gap: .9rem; }
    body.av1-legacy .av1-acct-av, body.av1-legacy .av1-acct-av img { width: 4rem; height: 4rem; }
    body.av1-legacy .av1-acct-who h1 { font-size: 1.25rem; }
    body.av1-legacy .av1-acct-actions { width: 100%; }
    body.av1-legacy .av1-acct-actions .btn:not(.av1-shell):not(.av1-shell *) { flex: 1; justify-content: center; }
    body.av1-legacy .av1-acct-tabs { margin: 1rem -1rem 1.25rem; padding: 0 .25rem; }
    body.av1-legacy .av1-acct-tab:not(.av1-shell):not(.av1-shell *) { padding: .85rem .75rem .95rem; }
}

/* ── Live chat: message body text readable (the --lv-* muted ink mapped too dim) ── */
body.av1-legacy .lv-body:not(.av1-shell):not(.av1-shell *) { color: rgb(var(--lead)); }

/* ── Light mode: pieces drawn on a photo or a player stay dark in both modes ── */
/* AnimeFLV's .AnflvTl band (bgb.jpg texture): light ink on the texture. */
body.av1-legacy .AnflvTl:not(.av1-shell):not(.av1-shell *),
body.av1-legacy .AnflvTl :is(h1, h2, p, span, div):not(.av1-shell):not(.av1-shell *) { color: #cfd8dc; }
body.av1-legacy .AnflvTl :is(strong, b):not(.av1-shell):not(.av1-shell *) { color: #fff; }
/* The profile card header (blurred avatar over a dark box). */
body.av1-legacy .Wdgt.User .Avatar:not(.av1-shell):not(.av1-shell *) { background-color: rgb(26 27 37); }
body.av1-legacy .Wdgt.User .Avatar .Name:not(.av1-shell):not(.av1-shell *) { color: #fff; }
body.av1-legacy .Wdgt.User .Avatar .af-cy-card-rank:not(.av1-shell):not(.av1-shell *) { color: rgb(255 255 255 / .72); }
/* W2G join gate over the player. */
body.av1-legacy .af-w2g-gate .af-w2g-screen-name:not(.av1-shell):not(.av1-shell *) { color: #fff; }
body.av1-legacy .af-w2g-gate .af-w2g-screen-sub:not(.av1-shell):not(.av1-shell *) { color: rgb(255 255 255 / .7); }

/* ── .CapiTnv tab rows (W2G servers, Super X / ranking windows): accent on the active one ── */
body.av1-legacy .CapiTnv > li > a:not(.av1-shell):not(.av1-shell *) { color: rgb(var(--subs)); }
body.av1-legacy .CapiTnv > li > a:not(.av1-shell):not(.av1-shell *):hover { color: rgb(var(--lead)); }
body.av1-legacy .CapiTnv > li > a.active:not(.av1-shell):not(.av1-shell *) { background-color: rgb(var(--main) / .14); color: rgb(var(--main)); }
