/* ============================================================================
   Subtle Skin Engine (v2 — safe). Keeps the ORIGINAL header + grid 100% intact.
   Varies ONLY cosmetic details per site so sites don't look identical:
     • card title treatment   (mt-card-*)
     • section heading style   (mt-home-*)
     • badge + thumbnail feel  (mt-ft-*)
     • spacing / title size    (mt-d-*)
   NOTHING here changes header structure, grid display, or element positions
   (except the self-contained "overlay" title, which stays inside the card box).
   ============================================================================ */

/* ---- density: gentle spacing + title size (grid columns unchanged) --------- */
body.mt-d-compact  { --mtx-gap: 14px; --mtx-pad: 30px; --mtx-title: .92rem; }
body.mt-d-normal   { --mtx-gap: 18px; --mtx-pad: 40px; --mtx-title: .96rem; }
body.mt-d-spacious { --mtx-gap: 24px; --mtx-pad: 52px; --mtx-title: 1rem; }
.mtsec  { margin-bottom: var(--mtx-pad, 40px); }
.mtgrid { gap: calc(var(--mtx-gap,18px) + 4px) var(--mtx-gap,18px); }
.mtc-title { font-size: var(--mtx-title, .96rem); }

/* baseline polish for every site: title turns accent on hover */
.mtc-title a { transition: color .15s ease; }
.mtc:hover .mtc-title a { color: var(--c-accent, #e60000); }

/* ============================ CARD STRUCTURAL VARIANTS =====================
   These match the per-site DOM emitted by vbase_card() (different markup, not
   just CSS). Each renders cleanly inside the standard grid.                     */

/* default (.mtc) — theme baseline (avatar-left + full sub). */

/* overlay: caption is a child of the thumb anchor → sits over the image. */
.mtc-v-overlay .mtc-over {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 12px 12px; z-index: 2;
  background: linear-gradient(to top, rgba(0,0,0,.9) 18%, rgba(0,0,0,.35) 62%, transparent);
}
.mtc-v-overlay .mtc-over .mtc-title { margin: 0 0 3px; }
.mtc-v-overlay .mtc-title a, .mtc-v-overlay:hover .mtc-title a { color: #fff; }
.mtc-v-overlay .mtc-sub { color: rgba(255,255,255,.82); }

/* minimal: no avatar node at all; clean title + stats. */
.mtc-v-min .mtc-meta { width: 100%; }

/* accent: a channel chip row above the title, accent left-bar on the meta. */
.mtc-v-accent .mtc-meta { border-left: 3px solid var(--c-accent,#e60000); padding-left: 10px; }
.mtc-v-accent .mtc-title { font-weight: 800; }
.mtc-v-accent .mtc-chip { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; font-size: .76rem; color: var(--c-muted,#aaa); font-weight: 600; }
.mtc-v-accent .mtc-chip .mtc-av { width: 22px; height: 22px; font-size: .72rem; }

/* ============================ SECTION HEADINGS ============================
   Restyle only the section <h2>. Grid is untouched.                            */

/* grid — plain (default). */
body.mt-home-hero    .mtsec-head h2 { border-left: 4px solid var(--c-accent,#e60000); padding-left: 11px; font-weight: 800; }
body.mt-home-rows    .mtsec-head h2 { display: inline-block; padding-bottom: 6px; border-bottom: 3px solid var(--c-accent,#e60000); }
body.mt-home-masonry .mtsec-head h2::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c-accent,#e60000); margin-right: 9px; vertical-align: middle; }
body.mt-home-sidebar .mtsec-head h2 { text-transform: uppercase; letter-spacing: .07em; }
body.mt-home-list    .mtsec-head h2 { color: var(--c-accent,#e60000); }

/* ============================ BADGE / THUMBNAIL FEEL ======================
   Tie thumbnail corners + duration/quality badge to the footer axis.           */

/* rich — default rounded thumb + dark badge. */
body.mt-ft-slim    .mtc-thumb { border-radius: 6px; }
body.mt-ft-slim    .mtc-q     { background: var(--c-accent,#e60000); color: #fff; }
body.mt-ft-columns .mtc-thumb { border-radius: 16px; }
body.mt-ft-columns .mtc-dur   { background: rgba(0,0,0,.62); border: 1px solid rgba(255,255,255,.45); }

/* ============================ HEADER STRUCTURAL VARIANTS ===================
   Match the per-site header DOM from header.php (different element order +
   grouping wrappers). All keep a clean single/two-row bar. Mobile falls back to
   the theme's stacked behavior so the nav drawer keeps working.                 */

/* classic — theme default (no override). */

/* search: search field grows in the middle. */
.mth-v-search .mthead-search { flex: 1; }

/* centered: two rows — brand+actions, then centered nav+search. */
.mth-v-centered .mthead-in { flex-direction: column; align-items: stretch; gap: 10px; }
.mth-v-centered .mthead-row { display: flex; align-items: center; gap: 14px; width: 100%; }
.mth-v-centered .mthead-r1 { justify-content: space-between; }
.mth-v-centered .mthead-r2 { justify-content: center; }
.mth-v-centered .mthead-r2 .mthead-search { flex: 0 1 480px; }

/* split: logo left, everything else grouped to the right. */
.mth-v-split .mthead-grp { display: flex; align-items: center; gap: 14px; margin-left: auto; }

/* stack: brand group + tools group on row 1, full-width nav on row 2. */
.mth-v-stack .mthead-in { flex-direction: column; align-items: stretch; gap: 8px; }
.mth-v-stack .mthead-row { display: flex; align-items: center; gap: 14px; }
.mth-v-stack .mthead-r1 { justify-content: space-between; }
.mth-v-stack .mthead-grp { display: flex; align-items: center; gap: 12px; }
.mth-v-stack .mthead-r1 .mthead-search { flex: 1; max-width: 440px; }
.mth-v-stack .mthead-r2 { border-top: 1px solid var(--c-line,#272727); padding-top: 6px; overflow-x: auto; }

/* mobile: unified, robust header for EVERY variant — [burger][logo][actions] on one
   row, full-width search below, nav in the burger dropdown. Uses !important because the
   desktop per-variant rules (.mth-v-* .mthead-r2 .mthead-search, specificity 0,3,0) are
   MORE specific than these overrides and would otherwise leak into mobile and hide the
   burger + actions (Upload/avatar/dark-mode). Keeping this predictable > a fancy
   per-variant mobile layout that silently drops the menu. */
@media (max-width: 900px) {
  .mthead-in { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 10px !important; }
  .mthead-row, .mthead-grp { display: contents !important; }
  .mthead-burger { display: grid !important; order: 1 !important; }
  .mthead-logo   { order: 2 !important; flex: 0 1 auto !important; justify-content: flex-start !important; }
  .mthead-actions{ order: 3 !important; margin-left: auto !important; }
  .mthead-search { order: 4 !important; flex: 1 1 100% !important; margin: 0 !important; max-width: none !important; }

  /* Mobile burger menu = clean floating dropdown panel (was rendering in-flow,
     unstyled). Anchor to the header + force the absolute panel. */
  .mthead { position: relative; }
  body.mtnav-open .mthead-nav {
    position: absolute !important; left: 10px; right: 10px; top: calc(100% + 6px);
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--c-surface, #1a1a1a); border: 1px solid var(--c-line, #272727); border-radius: 14px;
    padding: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 1100; max-height: 72vh; overflow-y: auto;
  }
  body.mtnav-open .mthead-nav ul, body.mtnav-open .mthead-nav .menu { flex-direction: column; align-items: stretch; gap: 2px; width: 100%; }
  body.mtnav-open .mthead-nav a { padding: 11px 14px; border-radius: 9px; }
}

/* ============================ PER-CARD CHROME (watch-later + play) ==========
   The watch-later button + play overlay repeat on every card → vary them per site
   so they're not identical. Position by card variant, shape/size by footer axis;
   the WL ICON itself also varies (set in vbase_card by the footer axis).         */
.mt-card-overlay .mtwl { left: 8px; right: auto; }                 /* top-left */
.mt-card-minimal .mtwl { top: auto; bottom: 8px; }                 /* bottom-right */
.mt-card-accent  .mtwl { left: 8px; right: auto; top: auto; bottom: 8px; } /* bottom-left */
.mt-ft-slim    .mtwl { border-radius: 7px; }                       /* rounded-square */
.mt-ft-columns .mtwl { width: 34px; height: 34px; }               /* larger circle */
/* centered play circle (always visible, like the references) */
.mtc-play { opacity: .92; background: transparent; }
.mtc-thumb:hover .mtc-play { opacity: 1; }
.mtc-play svg { width: 46px; height: 46px; fill: #fff; background: rgba(0,0,0,.5); border-radius: 50%; padding: 13px; box-sizing: border-box; filter: none; }
.mtc-thumb:hover .mtc-play svg { background: var(--c-accent, #e60000); }
.mt-card-minimal .mtc-play svg { width: 40px; height: 40px; }
.mt-card-accent  .mtc-play svg { width: 52px; height: 52px; }
.mt-card-overlay .mtc-play { background: transparent; }

/* ============================ APP POLISH (reference-grade) =================
   Mobile bottom tab bar + icon pills + verified badge — app-style, like the
   user's reference designs.                                                     */

/* search bar — subtle neutral pill that reads well on BOTH light + dark themes */
.mthead-search input { background: rgba(127,127,127,.1); }
.mthead-search button { background: rgba(127,127,127,.16); }

/* pill icons */
.mtpill-i { display: inline-flex; vertical-align: middle; margin-right: 6px; }
.mtpill-i svg { width: 14px; height: 14px; }

/* verified check next to channel names */
.mtverified { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--c-accent, #e60000); }
.mtverified svg { width: 13px; height: 13px; }

/* mobile bottom tab bar */
.mttab { display: none; }
@media (max-width: 900px) {
  .mttab { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; height: 58px;
    background: var(--c-surface, #1a1a1a); border-top: 1px solid var(--c-line, #272727);
    padding: 0 4px calc(0px + env(safe-area-inset-bottom, 0px)); align-items: center; }
  .mttab-i { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .62rem; font-weight: 600; text-decoration: none; height: 100%;
    /* reset native <button> chrome AND override the theme's broad `button{background:var(--vb-red)!important}`
       rule (some slots are <button> now) so they render like the <a> items. */
    background: transparent !important; border: 0 !important; border-radius: 0 !important; color: var(--c-muted, #aaa) !important;
    -webkit-appearance: none; appearance: none; font-family: inherit; cursor: pointer; padding: 0; }
  .mttab-i.on { color: var(--c-accent, #e60000) !important; }
  .mttab-i svg { width: 22px; height: 22px; }
  /* center FAB: same flex slot as the others (so 2 left / 2 right stay symmetric),
     a centered raised red circle, no label. */
  .mttab-fab { gap: 0; }
  .mttab-fab svg { width: 26px; height: 26px; color: #fff;
    background: var(--c-accent, #e60000); width: 50px; height: 50px; padding: 12px; border-radius: 50%;
    margin-top: -18px; box-shadow: 0 4px 14px rgba(0,0,0,.35); box-sizing: border-box; }
  /* clear the fixed 58px tab bar PLUS the iOS home-indicator safe area (the bar itself
     grows by safe-area) — otherwise the last content sits hidden under the bar and the
     page appears to "not scroll to the bottom". */
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
}

/* ============================ YOUTUBE-STYLE LEFT SIDEBAR SHELL =============
   home=sidebar → a fixed left nav rail (desktop) + content shifted right, like
   the reference. Hidden on mobile (the bottom tab bar takes over).              */
.mtside { display: none; }
@media (min-width: 1000px) {
  body.mt-home-sidebar .mtside { display: block; position: fixed; top: 0; left: 0; bottom: 0; width: 224px; z-index: 60;
    background: var(--c-surface, #1a1a1a); border-right: 1px solid var(--c-line, #272727); padding: 72px 10px 24px; overflow-y: auto; }
  body.mt-home-sidebar .mtmain, body.mt-home-sidebar #footer, body.mt-home-sidebar #colophon { margin-left: 224px; }
  body.mt-home-sidebar .mthead-nav { display: none; } /* nav lives in the sidebar */
  body.mt-home-sidebar .mthead { z-index: 70; } /* header bar above the sidebar */
  .mtside-nav { display: flex; flex-direction: column; gap: 2px; }
  .mtside-i { display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 10px; color: var(--c-text, #f1f1f1); text-decoration: none; font-size: .88rem; font-weight: 600; }
  .mtside-i svg { width: 22px; height: 22px; flex: 0 0 auto; }
  .mtside-i:hover { background: rgba(127,127,127,.12); }
  .mtside-i.on { background: var(--c-accent, #e60000); color: #fff; }
  .mtside-sec { color: var(--c-muted, #aaa); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 16px 12px 6px; border-top: 1px solid var(--c-line, #272727); margin-top: 10px; }
}

/* hero = swipeable featured carousel (shown for sidebar + hero homes). */
.mthero { display: none; }
body.mt-home-sidebar .mthero, body.mt-home-hero .mthero { display: block; position: relative; margin: 0 0 22px; }
.mthero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 16px; }
.mthero-track::-webkit-scrollbar { display: none; }
.mthero-slide { position: relative; flex: 0 0 100%; scroll-snap-align: center; min-height: 320px; display: flex; align-items: flex-end;
  background: var(--c-surface, #1a1a1a) center/cover no-repeat; border-radius: 16px; text-decoration: none; color: #fff; }
/* lighter gradient — image is the star; only the bottom darkens for text legibility */
.mthero-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,.15) 42%, transparent 70%); border-radius: 16px; }
.mthero-cap { position: relative; z-index: 1; padding: 22px 26px 38px; max-width: 620px; }
.mthero-tag { display: inline-block; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--c-accent, #e60000); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.mthero-cap h2 { margin: 0 0 14px; font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: #fff; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mthero-btn { display: inline-block; background: #fff; color: #111; font-weight: 800; padding: 9px 18px; border-radius: 999px; }
.mthero-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.mthero-dots button { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); border: 0; padding: 0; cursor: pointer; transition: .2s; }
.mthero-dots button.on { background: #fff; width: 22px; border-radius: 5px; }
@media (max-width: 700px) { .mthero-slide { min-height: 200px; } .mthero-cap { padding: 22px 22px 34px; } .mthero-cap h2 { font-size: 1.3rem; } }

/* ============================ NEON STYLE (mt-style-neon) ===================
   Futuristic gradient treatment (logo/FAB/pills/play/hero glow) — like the
   neon reference designs. Triggered by the 'neon' color palette.               */
.mt-style-neon { --vb-grad: linear-gradient(120deg, #a855f7, #22d3ee 58%, #ec4899); }
.mt-style-neon .mthead-name { background: var(--vb-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.mt-style-neon .mthead-logo .mark { background: var(--vb-grad); }
.mt-style-neon .mtpill.active { background: var(--vb-grad); border-color: transparent; color: #fff; }
.mt-style-neon .mthead-search button { background: var(--vb-grad); color: #fff; }
.mt-style-neon .mttab-fab svg { background: var(--vb-grad) !important; }
.mt-style-neon .mtc:hover .mtc-play svg { background: var(--vb-grad) !important; }
.mt-style-neon .mthero { background: linear-gradient(120deg, #a855f7, #6d28d9 48%, #0b0f1e 100%); }
.mt-style-neon .mtside-i.on { background: var(--vb-grad); }
.mt-style-neon .mtc-thumb { box-shadow: 0 0 0 1px rgba(168,85,247,.28); }
.mt-style-neon .mtsec-head h2 { background: var(--vb-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ============================ GLASS STYLE (mt-style-glass) =================
   Glassmorphism — frosted translucent cards/header/pills over a soft color glow.  */
body.mt-style-glass { background:
  radial-gradient(900px 480px at 82% -8%, rgba(245,158,11,.32), transparent 60%),
  radial-gradient(700px 500px at -10% 30%, rgba(168,85,247,.18), transparent 60%),
  var(--c-bg, #181206); }
.mt-style-glass .mtsec .mtgrid .mtc { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.mt-style-glass .mtc-thumb { border-radius: 13px; }
.mt-style-glass .mtc-body { padding: 9px 6px 5px; }
.mt-style-glass .mtpill { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(10px); }
.mt-style-glass .mtpill.active { background: rgba(255,255,255,.22); }
.mt-style-glass .mthead { background: rgba(20,16,8,.55); border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.mt-style-glass .mthead-search input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
.mt-style-glass .mtside { background: rgba(20,16,8,.45); backdrop-filter: blur(16px); }
.mt-style-glass .mttab { background: rgba(20,16,8,.6); backdrop-filter: blur(16px); }
.mt-style-glass .mthero-slide { border-radius: 20px; }

/* ============================ TABS STYLE (mt-style-tabs) ===================
   Filter pills → underline text-tabs; bottom bar → flat 5-icon (no raised FAB). */
.mt-style-tabs .mtpills { gap: 2px; border-bottom: 1px solid var(--c-line, #272727); }
.mt-style-tabs .mtpill { background: transparent !important; border: 0 !important; border-radius: 0 !important; color: var(--c-muted, #aaa); padding: 11px 14px; border-bottom: 2px solid transparent !important; }
.mt-style-tabs .mtpill.active { color: var(--c-accent, #e60000); border-bottom-color: var(--c-accent, #e60000) !important; background: transparent !important; }
.mt-style-tabs .mtpill-i { display: none; }
@media (max-width: 900px) {
  .mt-style-tabs .mttab-fab svg { margin-top: 0; background: transparent !important; width: 24px; height: 24px; padding: 0; color: var(--c-muted, #aaa); border-radius: 0; box-shadow: none; }
}

/* (watch + footer widgets: keep the theme's original layout — no overrides) */

/* ── Doujin: BIG CENTERED header logo on MOBILE too (override the mobile !important block) ── */
@media (max-width: 900px) {
  body.mt-base-doujin .mthead-in { justify-content: center !important; row-gap: 6px !important; padding-top: 8px !important; }
  body.mt-base-doujin .mthead-logo { order: -1 !important; flex: 1 0 100% !important; justify-content: center !important; }
  body.mt-base-doujin .mthead-logo.has-img img.custom-logo { height: 54px !important; max-width: 82vw !important; }
  body.mt-base-doujin .mthead-burger { position: absolute !important; left: 8px !important; top: 12px !important; order: 0 !important; }
  body.mt-base-doujin .mthead-actions { order: 3 !important; margin-left: 0 !important; }
  body.mt-base-doujin .mthead-search { order: 4 !important; flex: 1 1 100% !important; }
}
@media (max-width: 480px) {
  body.mt-base-doujin .mthead-logo.has-img img.custom-logo { height: 46px !important; }
}

/* ── โดจินวาย (BL) violet skin — MOBILE: keep the header a ROW (logo left) instead of the big-centered
   doujin logo, + violet bottom bar. Overrides the doujin-mobile !important block above. ── */
@media (max-width: 900px) {
  body.mt-base-doujin.mt-color-doujinv .mthead-in { justify-content: flex-start !important; row-gap: 0 !important; padding-top: 8px !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-logo { order: 0 !important; flex: 0 0 auto !important; justify-content: flex-start !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-logo.has-img img.custom-logo { height: 34px !important; max-width: 150px !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-burger { position: static !important; left: auto !important; top: auto !important; order: -1 !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-search { order: 5 !important; flex-basis: 100% !important; max-width: 100% !important; }
  /* violet bottom bar: gradient top hairline + rounded active pill */
  body.mt-base-doujin.mt-color-doujinv .mttab { border-top: 0; box-shadow: 0 -1px 0 var(--c-line), 0 -6px 16px rgba(124,58,237,.16); }
  body.mt-base-doujin.mt-color-doujinv .mttab-i.on { color: #fff !important; }
  body.mt-base-doujin.mt-color-doujinv .mttab-i.on::before { content:""; position:absolute; top:8px; width:34px; height:26px; border-radius:9px; background:linear-gradient(135deg,#a855f7,#7c3aed); z-index:-1; }
  body.mt-base-doujin.mt-color-doujinv .mttab-i { position: relative; }
}
@media (max-width: 480px) {
  body.mt-base-doujin.mt-color-doujinv .mthead-logo.has-img img.custom-logo { height: 30px !important; }
}

/* ── โดจินวาย (BL) MOBILE header cleanup — consistent icon buttons, burger not a big filled block ── */
@media (max-width: 900px) {
  body.mt-base-doujin.mt-color-doujinv .mthead-in { gap: 8px !important; align-items: center !important; padding: 8px 12px !important; }
  /* burger = clean outline icon (was a big violet filled square) */
  body.mt-base-doujin.mt-color-doujinv .mthead-burger {
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    width: 40px !important; height: 40px !important; padding: 0 !important; border-radius: 10px !important;
    color: var(--c-text) !important; order: 0 !important; position: static !important; flex: 0 0 auto !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
  }
  body.mt-base-doujin.mt-color-doujinv .mthead-burger svg { width: 24px !important; height: 24px !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-logo { order: 1 !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-logo.has-img img.custom-logo { height: 34px !important; max-width: 150px !important; }
  /* moon + random: equal compact icon buttons, hide the "สุ่มโดจิน" text (keep icon) */
  body.mt-base-doujin.mt-color-doujinv .mthead-actions { order: 2 !important; gap: 7px !important; margin-left: auto !important; align-items: center !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-actions > * {
    width: 40px !important; height: 40px !important; min-width: 0 !important; padding: 0 !important; border-radius: 12px !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important; flex: 0 0 auto !important;
  }
  body.mt-base-doujin.mt-color-doujinv .mthead-actions svg { width: 21px !important; height: 21px !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-upload span { display: none !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-search { order: 4 !important; flex: 1 1 100% !important; max-width: 100% !important; margin: 0 !important; }
}

/* ══ โดจินวาย PREMIUM mobile header (ref: "Icon Balance") — outline-circle icon buttons,
   centered logo, generous spacing. Supersedes the earlier violet-mobile rules (later-wins). ══ */
@media (max-width: 900px) {
  body.mt-base-doujin.mt-color-doujinv .mthead { background: linear-gradient(180deg,#161031,#100c1c) !important; box-shadow: 0 1px 0 rgba(168,85,247,.22) !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-in { gap: 6px !important; align-items: center !important; padding: 11px 14px !important; flex-wrap: wrap !important; row-gap: 8px !important; justify-content: flex-start !important; height: auto !important; }
  /* every icon button = thin outline circle, accent-colored glyph */
  body.mt-base-doujin.mt-color-doujinv .mthead-burger,
  body.mt-base-doujin.mt-color-doujinv .mthead-actions > * {
    background: transparent !important; border: 1.5px solid rgba(168,85,247,.5) !important; box-shadow: none !important;
    width: 42px !important; height: 42px !important; min-width: 42px !important; padding: 0 !important; border-radius: 50% !important;
    color: var(--c-accent) !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; flex: 0 0 auto !important; margin: 0 !important;
  }
  body.mt-base-doujin.mt-color-doujinv .mthead-burger:active,
  body.mt-base-doujin.mt-color-doujinv .mthead-actions > *:active { background: rgba(168,85,247,.14) !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-burger { order: 0 !important; position: static !important; left: auto !important; top: auto !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-burger svg,
  body.mt-base-doujin.mt-color-doujinv .mthead-actions svg { width: 20px !important; height: 20px !important; }
  /* logo CENTERED between burger (left) and the action circles (right) */
  body.mt-base-doujin.mt-color-doujinv .mthead-logo { order: 1 !important; flex: 1 1 auto !important; justify-content: center !important; display: flex !important; padding: 0 6px !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-logo.has-img img.custom-logo { height: 40px !important; max-width: 58vw !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-actions { order: 2 !important; gap: 8px !important; margin-left: 0 !important; align-items: center !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-upload span { display: none !important; }
  /* premium rounded search pill full-width below the row */
  body.mt-base-doujin.mt-color-doujinv .mthead-search { order: 4 !important; flex: 1 1 100% !important; max-width: 100% !important; margin: 2px 0 0 !important; }
  body.mt-base-doujin.mt-color-doujinv .mthead-search input { border-radius: 999px !important; border: 1px solid rgba(168,85,247,.3) !important; }
}

/* ── STORY (novel-app) MOBILE header/bar polish — clean burger + gold actions ── */
@media (max-width: 900px) {
  body.mt-base-story .mthead-in { gap: 8px !important; align-items: center !important; padding: 10px 13px !important; }
  /* burger = clean gold icon (not a filled block) */
  body.mt-base-story .mthead-burger {
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    width: 42px !important; height: 42px !important; padding: 0 !important; border-radius: 12px !important;
    color: var(--c-accent) !important; order: 0 !important; position: static !important; flex: 0 0 auto !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
  }
  body.mt-base-story .mthead-burger:active { background: rgba(232,180,94,.14) !important; }
  body.mt-base-story .mthead-burger svg { width: 25px !important; height: 25px !important; }
  body.mt-base-story .mthead-logo { order: 1 !important; }
  body.mt-base-story .mthead-logo.has-img img.custom-logo { height: 34px !important; max-width: 160px !important; }
  /* moon + shuffle: equal gold outline-circle icon buttons (consistent, not mismatched sizes) */
  body.mt-base-story .mthead-actions { order: 2 !important; gap: 8px !important; margin-left: auto !important; align-items: center !important; }
  body.mt-base-story .mthead-actions > * {
    background: transparent !important; border: 1.5px solid rgba(232,180,94,.5) !important; box-shadow: none !important;
    width: 40px !important; height: 40px !important; min-width: 40px !important; padding: 0 !important; border-radius: 50% !important;
    color: var(--c-accent) !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; flex: 0 0 auto !important; margin: 0 !important;
  }
  body.mt-base-story .mthead-actions svg { width: 20px !important; height: 20px !important; }
  body.mt-base-story .mthead-upload span { display: none !important; }
  body.mt-base-story .mthead-search { order: 4 !important; flex: 1 1 100% !important; max-width: 100% !important; margin: 2px 0 0 !important; }
  body.mt-base-story .mthead-search input { border-radius: 999px !important; border: 1px solid var(--c-line) !important; background: var(--c-surface) !important; }
  /* nav dropdown (burger open) — dark card, gold hover */
  body.mt-base-story.mtnav-open .mthead-nav { background: var(--c-surface) !important; border: 1px solid var(--c-line) !important; }
  body.mt-base-story.mtnav-open .mthead-nav a { color: var(--c-text) !important; }
  body.mt-base-story.mtnav-open .mthead-nav a:active { background: rgba(232,180,94,.12) !important; color: var(--c-accent) !important; }
  /* bottom bar: gold FAB search + gold active */
  body.mt-base-story .mttab-i.on { color: var(--c-accent) !important; }
}

/* ── STORY bottom bar: FLAT search tab (no raised FAB) — matches the novel-app reference (5 equal tabs) ── */
@media (max-width: 900px) {
  /* keep the raised gold FAB only on video/doujin; on story flatten it to a normal tab */
  body:not(.mt-base-story) .mttab-fab span { display: none; }
  body.mt-base-story .mttab-fab svg {
    background: transparent !important; width: 24px !important; height: 24px !important; padding: 0 !important;
    margin-top: 0 !important; border-radius: 0 !important; box-shadow: none !important; color: currentColor !important;
  }
  body.mt-base-story .mttab-fab { color: var(--c-muted) !important; }
  body.mt-base-story .mttab-fab span { display: block; }
  body.mt-base-story .mttab { background: #0a0a11 !important; }
}
