/* ============================================================================
   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   (ia-card-*)
     • section heading style   (ia-home-*)
     • badge + thumbnail feel  (ia-ft-*)
     • spacing / title size    (ia-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.ia-d-compact  { --iax-gap: 14px; --iax-pad: 30px; --iax-title: .92rem; }
body.ia-d-normal   { --iax-gap: 18px; --iax-pad: 40px; --iax-title: .96rem; }
body.ia-d-spacious { --iax-gap: 24px; --iax-pad: 52px; --iax-title: 1rem; }
.iasec  { margin-bottom: var(--iax-pad, 40px); }
.iagrid { gap: calc(var(--iax-gap,18px) + 4px) var(--iax-gap,18px); }
.iac-title { font-size: var(--iax-title, .96rem); }

/* baseline polish for every site: title turns accent on hover */
.iac-title a { transition: color .15s ease; }
.iac:hover .iac-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 (.iac) — theme baseline (avatar-left + full sub). */

/* overlay: caption is a child of the thumb anchor → sits over the image. */
.iac-v-overlay .iac-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);
}
.iac-v-overlay .iac-over .iac-title { margin: 0 0 3px; }
.iac-v-overlay .iac-title a, .iac-v-overlay:hover .iac-title a { color: #fff; }
.iac-v-overlay .iac-sub { color: rgba(255,255,255,.82); }

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

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

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

/* grid — plain (default). */
body.ia-home-hero    .iasec-head h2 { border-left: 4px solid var(--c-accent,#e60000); padding-left: 11px; font-weight: 800; }
body.ia-home-rows    .iasec-head h2 { display: inline-block; padding-bottom: 6px; border-bottom: 3px solid var(--c-accent,#e60000); }
body.ia-home-masonry .iasec-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.ia-home-sidebar .iasec-head h2 { text-transform: uppercase; letter-spacing: .07em; }
body.ia-home-list    .iasec-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.ia-ft-slim    .iac-thumb { border-radius: 6px; }
body.ia-ft-slim    .iac-q     { background: var(--c-accent,#e60000); color: #fff; }
body.ia-ft-columns .iac-thumb { border-radius: 16px; }
body.ia-ft-columns .iac-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. */
.iah-v-search .iahead-search { flex: 1; }

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

/* split: logo left, everything else grouped to the right. */
.iah-v-split .iahead-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. */
.iah-v-stack .iahead-in { flex-direction: column; align-items: stretch; gap: 8px; }
.iah-v-stack .iahead-row { display: flex; align-items: center; gap: 14px; }
.iah-v-stack .iahead-r1 { justify-content: space-between; }
.iah-v-stack .iahead-grp { display: flex; align-items: center; gap: 12px; }
.iah-v-stack .iahead-r1 .iahead-search { flex: 1; max-width: 440px; }
.iah-v-stack .iahead-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 (.iah-v-* .iahead-r2 .iahead-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) {
  .iahead-in { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 10px !important; }
  .iahead-row, .iahead-grp { display: contents !important; }
  .iahead-burger { display: grid !important; order: 1 !important; }
  .iahead-logo   { order: 2 !important; flex: 0 1 auto !important; justify-content: flex-start !important; }
  .iahead-actions{ order: 3 !important; margin-left: auto !important; }
  .iahead-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. */
  .iahead { position: relative; }
  body.ianav-open .iahead-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.ianav-open .iahead-nav ul, body.ianav-open .iahead-nav .menu { flex-direction: column; align-items: stretch; gap: 2px; width: 100%; }
  body.ianav-open .iahead-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).         */
.ia-card-overlay .iawl { left: 8px; right: auto; }                 /* top-left */
.ia-card-minimal .iawl { top: auto; bottom: 8px; }                 /* bottom-right */
.ia-card-accent  .iawl { left: 8px; right: auto; top: auto; bottom: 8px; } /* bottom-left */
.ia-ft-slim    .iawl { border-radius: 7px; }                       /* rounded-square */
.ia-ft-columns .iawl { width: 34px; height: 34px; }               /* larger circle */
/* centered play circle (always visible, like the references) */
.iac-play { opacity: .92; background: transparent; }
.iac-thumb:hover .iac-play { opacity: 1; }
.iac-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; }
.iac-thumb:hover .iac-play svg { background: var(--c-accent, #e60000); }
.ia-card-minimal .iac-play svg { width: 40px; height: 40px; }
.ia-card-accent  .iac-play svg { width: 52px; height: 52px; }
.ia-card-overlay .iac-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 */
.iahead-search input { background: rgba(127,127,127,.1); }
.iahead-search button { background: rgba(127,127,127,.16); }

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

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

/* mobile bottom tab bar */
.iatab { display: none; }
@media (max-width: 900px) {
  .iatab { 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; }
  .iatab-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; }
  .iatab-i.on { color: var(--c-accent, #e60000) !important; }
  .iatab-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. */
  .iatab-fab { gap: 0; }
  .iatab-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).              */
.iaside { display: none; }
@media (min-width: 1000px) {
  body.ia-home-sidebar .iaside { 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.ia-home-sidebar .iamain, body.ia-home-sidebar #footer, body.ia-home-sidebar #colophon { margin-left: 224px; }
  body.ia-home-sidebar .iahead-nav { display: none; } /* nav lives in the sidebar */
  body.ia-home-sidebar .iahead { z-index: 70; } /* header bar above the sidebar */
  .iaside-nav { display: flex; flex-direction: column; gap: 2px; }
  .iaside-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; }
  .iaside-i svg { width: 22px; height: 22px; flex: 0 0 auto; }
  .iaside-i:hover { background: rgba(127,127,127,.12); }
  .iaside-i.on { background: var(--c-accent, #e60000); color: #fff; }
  .iaside-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). */
.iahero { display: none; }
body.ia-home-sidebar .iahero, body.ia-home-hero .iahero { display: block; position: relative; margin: 0 0 22px; }
.iahero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 16px; }
.iahero-track::-webkit-scrollbar { display: none; }
.iahero-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 */
.iahero-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; }
.iahero-cap { position: relative; z-index: 1; padding: 22px 26px 38px; max-width: 620px; }
.iahero-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; }
.iahero-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; }
.iahero-btn { display: inline-block; background: #fff; color: #111; font-weight: 800; padding: 9px 18px; border-radius: 999px; }
.iahero-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.iahero-dots button { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); border: 0; padding: 0; cursor: pointer; transition: .2s; }
.iahero-dots button.on { background: #fff; width: 22px; border-radius: 5px; }
@media (max-width: 700px) { .iahero-slide { min-height: 200px; } .iahero-cap { padding: 22px 22px 34px; } .iahero-cap h2 { font-size: 1.3rem; } }

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

/* ============================ GLASS STYLE (ia-style-glass) =================
   Glassmorphism — frosted translucent cards/header/pills over a soft color glow.  */
body.ia-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); }
.ia-style-glass .iasec .iagrid .iac { 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); }
.ia-style-glass .iac-thumb { border-radius: 13px; }
.ia-style-glass .iac-body { padding: 9px 6px 5px; }
.ia-style-glass .iapill { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(10px); }
.ia-style-glass .iapill.active { background: rgba(255,255,255,.22); }
.ia-style-glass .iahead { background: rgba(20,16,8,.55); border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.ia-style-glass .iahead-search input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
.ia-style-glass .iaside { background: rgba(20,16,8,.45); backdrop-filter: blur(16px); }
.ia-style-glass .iatab { background: rgba(20,16,8,.6); backdrop-filter: blur(16px); }
.ia-style-glass .iahero-slide { border-radius: 20px; }

/* ============================ TABS STYLE (ia-style-tabs) ===================
   Filter pills → underline text-tabs; bottom bar → flat 5-icon (no raised FAB). */
.ia-style-tabs .iapills { gap: 2px; border-bottom: 1px solid var(--c-line, #272727); }
.ia-style-tabs .iapill { background: transparent !important; border: 0 !important; border-radius: 0 !important; color: var(--c-muted, #aaa); padding: 11px 14px; border-bottom: 2px solid transparent !important; }
.ia-style-tabs .iapill.active { color: var(--c-accent, #e60000); border-bottom-color: var(--c-accent, #e60000) !important; background: transparent !important; }
.ia-style-tabs .iapill-i { display: none; }
@media (max-width: 900px) {
  .ia-style-tabs .iatab-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.ia-base-doujin .iahead-in { justify-content: center !important; row-gap: 6px !important; padding-top: 8px !important; }
  body.ia-base-doujin .iahead-logo { order: -1 !important; flex: 1 0 100% !important; justify-content: center !important; }
  body.ia-base-doujin .iahead-logo.has-img img.custom-logo { height: 54px !important; max-width: 82vw !important; }
  body.ia-base-doujin .iahead-burger { position: absolute !important; left: 8px !important; top: 12px !important; order: 0 !important; }
  body.ia-base-doujin .iahead-actions { order: 3 !important; margin-left: 0 !important; }
  body.ia-base-doujin .iahead-search { order: 4 !important; flex: 1 1 100% !important; }
}
@media (max-width: 480px) {
  body.ia-base-doujin .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-in { justify-content: flex-start !important; row-gap: 0 !important; padding-top: 8px !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-logo { order: 0 !important; flex: 0 0 auto !important; justify-content: flex-start !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-logo.has-img img.custom-logo { height: 34px !important; max-width: 150px !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-burger { position: static !important; left: auto !important; top: auto !important; order: -1 !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-search { order: 5 !important; flex-basis: 100% !important; max-width: 100% !important; }
  /* violet bottom bar: gradient top hairline + rounded active pill */
  body.ia-base-doujin.ia-color-doujinv .iatab { border-top: 0; box-shadow: 0 -1px 0 var(--c-line), 0 -6px 16px rgba(124,58,237,.16); }
  body.ia-base-doujin.ia-color-doujinv .iatab-i.on { color: #fff !important; }
  body.ia-base-doujin.ia-color-doujinv .iatab-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.ia-base-doujin.ia-color-doujinv .iatab-i { position: relative; }
}
@media (max-width: 480px) {
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-in { gap: 8px !important; align-items: center !important; padding: 8px 12px !important; }
  /* burger = clean outline icon (was a big violet filled square) */
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-burger svg { width: 24px !important; height: 24px !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-logo { order: 1 !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-actions { order: 2 !important; gap: 7px !important; margin-left: auto !important; align-items: center !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-actions svg { width: 21px !important; height: 21px !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-upload span { display: none !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead { background: linear-gradient(180deg,#161031,#100c1c) !important; box-shadow: 0 1px 0 rgba(168,85,247,.22) !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-burger,
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-doujin.ia-color-doujinv .iahead-burger:active,
  body.ia-base-doujin.ia-color-doujinv .iahead-actions > *:active { background: rgba(168,85,247,.14) !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-burger { order: 0 !important; position: static !important; left: auto !important; top: auto !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-burger svg,
  body.ia-base-doujin.ia-color-doujinv .iahead-actions svg { width: 20px !important; height: 20px !important; }
  /* logo CENTERED between burger (left) and the action circles (right) */
  body.ia-base-doujin.ia-color-doujinv .iahead-logo { order: 1 !important; flex: 1 1 auto !important; justify-content: center !important; display: flex !important; padding: 0 6px !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-logo.has-img img.custom-logo { height: 40px !important; max-width: 58vw !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-actions { order: 2 !important; gap: 8px !important; margin-left: 0 !important; align-items: center !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-upload span { display: none !important; }
  /* premium rounded search pill full-width below the row */
  body.ia-base-doujin.ia-color-doujinv .iahead-search { order: 4 !important; flex: 1 1 100% !important; max-width: 100% !important; margin: 2px 0 0 !important; }
  body.ia-base-doujin.ia-color-doujinv .iahead-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.ia-base-story .iahead-in { gap: 8px !important; align-items: center !important; padding: 10px 13px !important; }
  /* burger = clean gold icon (not a filled block) */
  body.ia-base-story .iahead-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.ia-base-story .iahead-burger:active { background: rgba(232,180,94,.14) !important; }
  body.ia-base-story .iahead-burger svg { width: 25px !important; height: 25px !important; }
  body.ia-base-story .iahead-logo { order: 1 !important; }
  body.ia-base-story .iahead-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.ia-base-story .iahead-actions { order: 2 !important; gap: 8px !important; margin-left: auto !important; align-items: center !important; }
  body.ia-base-story .iahead-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.ia-base-story .iahead-actions svg { width: 20px !important; height: 20px !important; }
  body.ia-base-story .iahead-upload span { display: none !important; }
  body.ia-base-story .iahead-search { order: 4 !important; flex: 1 1 100% !important; max-width: 100% !important; margin: 2px 0 0 !important; }
  body.ia-base-story .iahead-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.ia-base-story.ianav-open .iahead-nav { background: var(--c-surface) !important; border: 1px solid var(--c-line) !important; }
  body.ia-base-story.ianav-open .iahead-nav a { color: var(--c-text) !important; }
  body.ia-base-story.ianav-open .iahead-nav a:active { background: rgba(232,180,94,.12) !important; color: var(--c-accent) !important; }
  /* bottom bar: gold FAB search + gold active */
  body.ia-base-story .iatab-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(.ia-base-story) .iatab-fab span { display: none; }
  body.ia-base-story .iatab-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.ia-base-story .iatab-fab { color: var(--c-muted) !important; }
  body.ia-base-story .iatab-fab span { display: block; }
  body.ia-base-story .iatab { background: #0a0a11 !important; }
}
