/* ==========================================================================
   MEMPHIS COMIC · WAP 组件层
   顶部栏 / 子页头 / 底部导航 / 侧滑抽屉 / 跑马灯 / 页脚 / 书架整理
   ========================================================================== */

/* ================================================================ 顶部栏 */
.mw-head {
    position: sticky;
    top: 0;
    z-index: 70;
    background: var(--cream);
    border-bottom: var(--bd);
}

.mw-head__strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: var(--strip-h);
    padding: 0 var(--gutter);
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: .08em;
    background: var(--ink);
    color: var(--cream);
}

.mw-head__strip b { color: var(--yellow); }
.mw-head__strip span { opacity: .72; }

.mw-head__in {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--head-h);
    padding: 0 var(--gutter);
}

.mw-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mw-brand img { width: 32px; height: 32px; flex: none; }
.mw-brand b {
    font-family: var(--f-disp);
    font-size: 15px;
    line-height: 1;
    letter-spacing: -.01em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.mw-brand span {
    display: block;
    font-family: var(--f-mono);
    font-size: 7.5px;
    letter-spacing: .14em;
    color: var(--ink-3);
}

.mw-head__btns { display: flex; align-items: center; gap: 7px; margin-left: auto; }

.mw-iconbtn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 16px;
    background: var(--paper);
    border: var(--bd-thin);
    border-radius: 50%;
    box-shadow: 2px 2px 0 var(--ink);
}

.mw-iconbtn--yellow { background: var(--yellow); }
.mw-iconbtn--pink { background: var(--pink); color: #fff; }

.mw-head__ava {
    width: 34px;
    height: 34px;
    border: var(--bd-thin);
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 2px 2px 0 var(--mint);
    background: var(--paper);
}

.mw-head__ava img { width: 100%; height: 100%; object-fit: cover; }

/* 搜索条 */
.mw-searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 var(--gutter) 9px;
}

.mw-searchbar form {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    height: 34px;
    background: var(--paper);
    border: var(--bd-thin);
    border-radius: 999px;
    box-shadow: 2px 2px 0 var(--blue);
    overflow: hidden;
}

.mw-searchbar input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 13px;
    font-size: 12.5px;
    background: none;
    border: 0;
}

.mw-searchbar input:focus { outline: none; }

.mw-searchbar button {
    width: 38px;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 15px;
    background: var(--yellow);
    border-left: var(--bd-thin);
}

/* ================================================================ 子页头 */
.mw-subhead {
    position: sticky;
    top: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--head-h);
    padding: 0 var(--gutter);
    background: var(--cream);
    border-bottom: var(--bd);
}

.mw-subhead__back {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 16px;
    background: var(--paper);
    border: var(--bd-thin);
    border-radius: 50%;
    box-shadow: 2px 2px 0 var(--ink);
    flex: none;
}

.mw-subhead__t {
    min-width: 0;
    font-family: var(--f-disp);
    font-size: 15px;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mw-subhead__t span {
    display: block;
    font-family: var(--f-mono);
    font-size: 8.5px;
    font-weight: 400;
    letter-spacing: .14em;
    color: var(--ink-3);
}

.mw-subhead__act { margin-left: auto; display: flex; gap: 7px; flex: none; }

/* ================================================================ 底部导航 */
.mdock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: flex;
    align-items: stretch;
    height: calc(var(--dock-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper);
    border-top: var(--bd);
    box-shadow: 0 -4px 0 rgba(43, 76, 255, .16);
}

.mdock__i {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 9.5px;
    letter-spacing: .04em;
    color: var(--ink-3);
    border-right: 1.5px dashed rgba(22, 19, 15, .16);
    transition: color .14s ease;
}

.mdock__i:last-child { border-right: 0; }
.mdock__i .icon { font-size: 18px; }

.mdock__i.is-on { color: var(--ink); font-weight: 700; }

.mdock__i.is-on .icon {
    padding: 4px;
    box-sizing: content-box;
    background: var(--yellow);
    border: 1.5px solid var(--ink);
    border-radius: 7px;
    box-shadow: 2px 2px 0 var(--pink);
}

/* ================================================================ 抽屉 */
.mdrawer {
    position: fixed;
    inset: 0;
    z-index: 300;
    visibility: hidden;
    pointer-events: none;
}

.mdrawer.is-on { visibility: visible; pointer-events: auto; }

.mdrawer__mask {
    position: absolute;
    inset: 0;
    background: rgba(22, 19, 15, .55);
    opacity: 0;
    transition: opacity .22s ease;
}

.mdrawer.is-on .mdrawer__mask { opacity: 1; }

.mdrawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 79%;
    max-width: 330px;
    display: flex;
    flex-direction: column;
    background: var(--cream);
    border-left: var(--bd);
    box-shadow: -6px 0 0 var(--pink);
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.2, .8, .3, 1);
    overflow-y: auto;
}

.mdrawer.is-on .mdrawer__panel { transform: none; }

.mdrawer__hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    background: var(--blue);
    color: #fff;
    border-bottom: var(--bd);
}

.mdrawer__hd img {
    width: 44px;
    height: 44px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    object-fit: cover;
    background: var(--paper);
}

.mdrawer__hd b { display: block; font-family: var(--f-disp); font-size: 15px; color: #fff; }
.mdrawer__hd span { font-family: var(--f-mono); font-size: 9.5px; color: rgba(255, 255, 255, .74); }

.mdrawer__hd .mw-iconbtn { margin-left: auto; border-color: var(--ink); }

.mdrawer__acts { display: flex; gap: 8px; padding: 12px 12px 0; }
.mdrawer__acts .mw-btn { flex: 1; min-width: 0; }

.mdrawer__nav { padding: 12px; }

.mdrawer__nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 700;
    background: var(--paper);
    border: var(--bd-thin);
    border-radius: 9px;
    box-shadow: 2px 2px 0 var(--ink);
}

.mdrawer__nav a i {
    font-family: var(--f-mono);
    font-size: 9.5px;
    font-style: normal;
    color: var(--pink);
}

.mdrawer__nav a .icon { margin-left: auto; font-size: 14px; color: var(--ink-3); }
.mdrawer__nav a:nth-child(3n + 1) { box-shadow: 2px 2px 0 var(--blue); }
.mdrawer__nav a:nth-child(3n + 2) { box-shadow: 2px 2px 0 var(--pink); }
.mdrawer__nav a:nth-child(3n) { box-shadow: 2px 2px 0 var(--yellow); }

/* 当前页：JS 会按 body[data-nav] 打 is-on */
.mdrawer__nav a.is-on {
    background: var(--yellow-soft);
    box-shadow: 3px 3px 0 var(--ink);
}
.mdrawer__nav a.is-on .icon { color: var(--ink); }

.mdrawer__foot {
    margin-top: auto;
    padding: 16px;
    font-family: var(--f-mono);
    font-size: 9.5px;
    line-height: 1.9;
    color: var(--ink-3);
    border-top: 1.5px dashed rgba(22, 19, 15, .2);
}

/* ================================================================ 跑马灯 */
.mw-ticker {
    display: flex;
    align-items: stretch;
    height: 34px;
    margin-top: 10px;
    background: var(--paper);
    border: var(--bd-thin);
    border-radius: 999px;
    box-shadow: 2px 2px 0 var(--ink);
    overflow: hidden;
}

.mw-ticker__tag {
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex: none;
    font-family: var(--f-mono);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    background: var(--pink);
    color: #fff;
    border-right: var(--bd-thin);
}

.mw-ticker__view { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.ticker__run { display: inline-block; white-space: nowrap; padding: 0 12px; line-height: 30px; }

.mw-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 22px;
    font-size: 11.5px;
    color: var(--ink-2);
}

.mw-ticker__item em { font-style: normal; font-weight: 700; color: var(--ink); }
.mw-ticker__item::after { content: "◆"; font-size: 7px; color: var(--pink); }

/* ================================================================ 页脚 */
.mw-foot {
    margin-top: 26px;
    padding: 24px var(--gutter) 28px;
    background: var(--ink);
    color: #efe7d8;
    border-top: var(--bd);
}

.mw-foot__brand { display: flex; align-items: center; gap: 10px; }
.mw-foot__brand img { width: 40px; height: 40px; }
.mw-foot__brand b { font-family: var(--f-disp); font-size: 15px; color: var(--yellow); }
.mw-foot__brand span { display: block; font-family: var(--f-mono); font-size: 8.5px; letter-spacing: .14em; color: #9b9385; }

.mw-foot__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 16px 0;
    font-size: 11.5px;
    color: #c9c1b3;
}

.mw-foot__links a { border-bottom: 1.5px solid transparent; }
.mw-foot__links a:hover { border-bottom-color: var(--pink); }

.mw-foot__copy {
    padding-top: 14px;
    font-family: var(--f-mono);
    font-size: 9.5px;
    line-height: 1.9;
    color: #8d8577;
    border-top: 1px dashed rgba(239, 231, 216, .24);
}

.mw-foot__desc {
    margin-top: 12px;
    font-size: 11.5px;
    line-height: 1.9;
    color: #b8b0a2;
}

.mw-foot__stat { margin-top: 10px; }

/* ================================================================ 书架整理 */
.selbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
    z-index: 75;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--yellow);
    border-top: var(--bd);
}

body.sel-mode .selbar { display: flex; }

.selbar__k { font-family: var(--f-mono); font-size: 11px; }
.selbar__k b { font-size: 14px; color: var(--pink); }
.selbar .mw-btn { margin-left: auto; }
.selbar .mw-btn:last-child { margin-left: 0; }

.shelf-item { position: relative; }

.shelf-item__pick {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    width: 22px;
    height: 22px;
    display: none;
    place-items: center;
    font-size: 12px;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    border-radius: 50%;
}

body.sel-mode .shelf-item__pick { display: grid; }
body.sel-mode .shelf-item > a { pointer-events: none; }

.shelf-item.is-picked .mw-book__pic { outline: 3px solid var(--pink); outline-offset: 1px; }
.shelf-item.is-picked .shelf-item__pick { background: var(--pink); color: #fff; }
