/*
 * 萌积分 前端样式 v1.1.0
 * 按钮：固定右下角，方形圆角白底蓝边
 * 弹窗：屏幕正中，白底蓝色配色
 */

/* ── 通用按钮 ───────────────────────────────────────────── */
.moe-btn {
    display:         inline-flex !important;
    align-items:     center !important;
    justify-content: center !important;
    gap:             5px !important;
    padding:         10px 24px !important;
    border:          none !important;
    border-radius:   50px !important;
    font-size:       14px !important;
    font-weight:     600 !important;
    cursor:          pointer !important;
    transition:      all .2s !important;
    text-decoration: none !important;
    width:           auto !important;
    min-width:       0 !important;
    max-width:       fit-content !important;
    white-space:     nowrap !important;
    box-sizing:      border-box !important;
    flex-shrink:     0 !important;
    line-height:     1.2 !important;
}
.moe-btn-primary {
    background: linear-gradient(135deg, #5bb8f5, #3a9cde);
    color: #fff;
    box-shadow: 0 3px 10px rgba(91,184,245,.35);
}
.moe-btn-primary:hover { opacity: .88; transform: translateY(-1px); color: #fff; }
.moe-btn-done,
.moe-btn-disabled { background: #eaf4fb; color: #9ac8e0; cursor: not-allowed; }

/* ── 签到 ────────────────────────────────────────────────── */
.moe-checkin {
    margin:          16px 0;
    display:         flex;
    justify-content: center;
}

/* ── 锁定内容框 ──────────────────────────────────────────── */
.moe-locked-box {
    margin: 16px 0;
    padding: 24px 20px;
    background: #f5fbff;
    border: 2px dashed #b8dff5;
    border-radius: 12px;
    text-align: center;
}
.moe-locked-msg { margin: 0 0 12px; color: #3a7aaa; font-size: 15px; }
.moe-locked-msg strong { color: #2a6fa0; }
.moe-locked-sub {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 14px;
    background: #daeefa;
    border-radius: 20px;
    font-size: 13px;
    color: #3a7aaa;
}
.moe-locked-action { margin-top: 12px; }
.moe-unlocked { border-left: 3px solid #5bb8f5; padding-left: 14px; margin: 8px 0; }

/* ── 排行榜短代码 ────────────────────────────────────────── */
.moe-rank-box {
    margin: 20px 0;
    background: #fff;
    border: 1px solid #b8dff5;
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(91,184,245,.12);
    overflow: hidden;
}
.moe-box-title {
    padding: 13px 18px;
    background: linear-gradient(135deg, #cce9fa, #dff2ff);
    color: #1e6fa0;
    font-size: 15px;
    font-weight: 700;
}
.moe-divider { height: 1px; background: #daeefa; border: none; margin: 0; }
.moe-rank-list { padding: 4px 0; }
.moe-rank-row {
    display: flex;
    align-items: center;
    padding: 9px 18px;
    gap: 8px;
    border-bottom: 1px solid #f0f8ff;
    transition: background .12s;
}
.moe-rank-row:hover { background: #f5fbff; }
.moe-rank-no  { font-size: 18px; min-width: 32px; line-height: 1; }
.moe-rank-name { flex: 1; font-size: 13px; font-weight: 600; color: #2a6a9a; }
.moe-rank-pts  { font-size: 13px; font-weight: 700; color: #3a9cde; }
.moe-my-block { padding: 14px 18px; border-top: 1px solid #daeefa; background: #f5fbff; }
.moe-my-row { padding: 4px 0; font-size: 14px; color: #2a6a9a; font-weight: 600; }
.moe-empty { text-align: center; color: #9ac8e0; padding: 20px; font-size: 13px; }

/* ── 卡密兑换 ────────────────────────────────────────────── */
.moe-card-box {
    margin: 20px 0;
    background: #fff;
    border: 1px solid #b8dff5;
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(91,184,245,.12);
    overflow: hidden;
}
.moe-card-hint { padding: 14px 18px 0; margin: 0; color: #3a7aaa; font-size: 14px; }
.moe-card-form { display: flex; gap: 10px; padding: 14px 18px; flex-wrap: wrap; align-items: center; }
.moe-input {
    flex: 1;
    min-width: 180px;
    padding: 9px 15px;
    border: 1.5px solid #b8dff5;
    border-radius: 50px;
    font-size: 14px;
    outline: none;
    color: #2a6a9a;
    transition: border-color .2s;
}
.moe-input:focus { border-color: #5bb8f5; }
.moe-msg { padding: 0 18px 14px; font-size: 13px; min-height: 20px; }
.moe-msg.success { color: #27ae60; }
.moe-msg.error   { color: #e74c3c; }

/* ── Toast 通知 ──────────────────────────────────────────── */
#moe-toast-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.moe-toast {
    padding: 10px 16px;
    background: #eaf6ff;
    border: 1px solid #a8d8f0;
    border-left: 3px solid #5bb8f5;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(91,184,245,.18);
    color: #2a6a9a;
    font-size: 13px;
    font-weight: 600;
    max-width: 240px;
    animation: moeIn .3s ease forwards;
}
.moe-toast.out { animation: moeOut .3s ease forwards; }
@keyframes moeIn  { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes moeOut { from { opacity:1; transform:translateX(0); }    to { opacity:0; transform:translateX(24px); } }

/* ═══════════════════════════════════════════════════════════
   固定积分按钮
   - 位置：屏幕右下角固定
   - 外观：方形圆角，白底，蓝色边框和文字
   ═══════════════════════════════════════════════════════════ */
#moe-ball {
    /* 定位 */
    position: fixed !important;
    bottom: 135px !important;
    right: 16px !important;
    top: auto !important;
    left: auto !important;

    /* 尺寸与形状 */
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 8px 15px !important;
    border-radius: 10px !important;   /* 方形圆角，不是圆形 */
    width: auto !important;
    height: auto !important;

    /* 颜色 */
    background: #ffffff !important;
    border: 1.5px solid #7cc8f0 !important;
    color: #2a8ccc !important;

    /* 文字 */
    font-size: 13px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;

    /* 其他 */
    cursor: pointer !important;
    z-index: 9000 !important;
    box-shadow: 0 2px 10px rgba(91,184,245,.25) !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: background .15s, box-shadow .15s, opacity .25s, transform .28s ease !important;
}
#moe-ball:hover  { background: #eaf6ff !important; box-shadow: 0 4px 16px rgba(91,184,245,.3) !important; }
#moe-ball:active { background: #d4edf8 !important; }
/* 上滑时隐藏 */
#moe-ball.moe-ball-hidden {
    opacity:        0 !important;
    transform:      translateY(140%) !important;
    pointer-events: none !important;
}

/* ═══════════════════════════════════════════════════════════
   遮罩层
   ═══════════════════════════════════════════════════════════ */
#moe-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(40,100,160,.2);
    z-index: 9001;
}
#moe-overlay.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   居中弹窗
   - 位置：屏幕正中央
   - 外观：白底，蓝色系配色
   ═══════════════════════════════════════════════════════════ */
#moe-panel {
    /* 居中定位 */
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    bottom: auto !important;
    right: auto !important;

    /* 尺寸 */
    width: 320px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: 78vh !important;

    /* 外观 */
    background: #ffffff !important;
    border: 1.5px solid #90cce8 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(40,120,200,.18), 0 2px 8px rgba(91,184,245,.15) !important;

    /* 布局 */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 9002 !important;

    will-change: opacity, transform;
    transition: opacity .18s ease, transform .2s ease !important;
}
#moe-panel.moe-panel-hidden {
    opacity: 0 !important;
    transform: translate(-50%, -46%) !important;
    pointer-events: none !important;
    pointer-events: none !important;
}

/* 弹窗标题栏 */
.moe-panel-hd {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    background: linear-gradient(135deg, #b8dcf5 0%, #d8f0ff 100%);
    border-bottom: 1px solid #90cce8;
    flex-shrink: 0;
}
.moe-panel-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #1a5f8a;
}
.moe-panel-close {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid #90cce8;
    background: rgba(255,255,255,.8);
    color: #3a8cbf;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s;
    line-height: 1;
}
.moe-panel-close:hover { background: #b8dcf5; color: #1a5f8a; }

/* 弹窗内容 */
.moe-panel-bd {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #90cce8 transparent;
}

/* 排行榜行 */
.moe-rank-section { padding: 0; }
.moe-panel-bd .moe-rank-row {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    gap: 8px;
    border-bottom: 1px solid #eef7fc;
    transition: background .1s;
}
.moe-panel-bd .moe-rank-row:hover           { background: #f2faff; }
.moe-panel-bd .moe-rank-row:nth-child(1)    { background: #fffbea; }
.moe-panel-bd .moe-rank-row:nth-child(2)    { background: #f8f8f8; }
.moe-panel-bd .moe-rank-row:nth-child(3)    { background: #fff5ee; }
.moe-panel-bd .moe-rank-no   { font-size: 18px; min-width: 30px; line-height: 1; }
.moe-panel-bd .moe-rank-name { flex: 1; font-size: 13px; font-weight: 600; color: #1e5a80; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moe-panel-bd .moe-rank-pts  { font-size: 13px; font-weight: 700; color: #2a8ccc; }

/* 弹窗分割线 */
.moe-panel-bd .moe-hr {
    height: 1px;
    margin: 6px 16px;
    background: #d0eaf8;
    border: none;
}

/* 我的积分 */
.moe-my-info { padding: 4px 16px 12px; }
.moe-my-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eef7fc;
    font-size: 13px;
}
.moe-my-row:last-child { border-bottom: none; }
.moe-my-label { color: #5a9ec0; }
.moe-my-val   { font-weight: 700; color: #1a5f8a; }

.moe-panel-bd .moe-empty { text-align: center; color: #9ac8e0; padding: 20px; font-size: 13px; }

/* 响应式 */
@media (max-width: 480px) {
    #moe-ball { bottom: 135px !important; right: 16px !important; }
}

/* 解锁剩余时间提示 */
.moe-expire-tip {
    margin: 0 0 10px;
    padding: 5px 12px;
    background: #eaf6ff;
    border-left: 3px solid #5bb8f5;
    border-radius: 4px;
    font-size: 12px;
    color: #5a90b8;
}

/* ── 评论区头像框 ─────────────────────────────────────────── */
/* 头像框容器：overflow visible 让框图片可以溢出 */
.moe-avatar-wrap {
    position:    relative;
    display:     inline-block;
    line-height: 0;
    flex-shrink: 0;
    overflow:    visible;   /* 关键：让框图片溢出容器边缘 */
}
/* 原始头像保持圆形 */
.moe-avatar-wrap > img:first-child {
    display:       block;
    width:         100%;
    height:        100%;
    border-radius: 50%;
}
/* 框图片：尺寸和偏移由 PHP 内联样式控制，这里只设通用属性 */
.moe-avatar-frame {
    object-fit:     contain;  /* 透明PNG完整显示，不裁剪 */
    pointer-events: none;
    z-index:        1;
}

/* ── 评论区头衔徽章 ──────────────────────────────────────── */
.moe-badge {
    display:       inline-block;
    margin-left:   5px;
    padding:       1px 7px;
    border-radius: 20px;
    font-size:     11px;
    font-weight:   600;
    color:         #fff;
    vertical-align: middle;
    white-space:   nowrap;
    line-height:   1.6;
}

/* 评论区头像链接 */
.moe-avatar-link {
    display:         inline-block;
    line-height:     0;
    text-decoration: none;
    vertical-align:  middle;
}

/* ════════════════════════════════════════════════════════════
 * v1.1 头衔系统样式
 * 包括：头衔徽章（常规/炫彩）、商店、头像框叠加、作者卡片
 * ════════════════════════════════════════════════════════════ */

/* ── 头衔徽章基础 ─────────────────────────────────────────── */
.moe-title-badge {
    display:         inline-flex;
    align-items:     center;
    padding:         2px 10px;
    border-radius:   10px;
    font-size:       12px;
    font-weight:     600;
    line-height:     1.5;
    vertical-align:  middle;
    margin:          0 6px 0 0;
    white-space:     nowrap;
    box-shadow:      0 1px 3px rgba(0,0,0,.08);
    letter-spacing:  .2px;
}
.moe-title-badge.moe-title-sm {
    font-size:     10px;
    padding:       1px 7px;
    border-radius: 8px;
    opacity:       .9;
}

/* 炫彩头衔（渐变底 + shimmer 动画） */
.moe-title-badge.moe-title-fancy {
    position:     relative;
    overflow:     hidden;
    background-size: 200% 100% !important;
}
.moe-title-badge.moe-title-shimmer::before {
    content:    '';
    position:   absolute;
    inset:      0;
    background: linear-gradient(
        100deg,
        rgba(255,255,255,0) 40%,
        rgba(255,255,255,.55) 50%,
        rgba(255,255,255,0) 60%
    );
    transform:   translateX(-100%);
    animation:   moe-shimmer 2.6s infinite;
    pointer-events: none;
}
@keyframes moe-shimmer {
    0%   { transform: translateX(-100%); }
    60%  { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}
.moe-title-badge.moe-title-fancy {
    animation: moe-fancy-glow 3.6s linear infinite;
}
@keyframes moe-fancy-glow {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

/* reduce motion 支持 */
@media (prefers-reduced-motion: reduce) {
    .moe-title-badge.moe-title-shimmer::before,
    .moe-title-badge.moe-title-fancy { animation: none !important; }
}

/* ── 评论区头像框叠加（JS 注入结构前提） ─────────────────── */
.moe-avatar-wrap {
    position:     relative;
    display:      inline-block;
    line-height:  0;
}
.moe-avatar-frame-overlay {
    position:      absolute;
    top:           50%;
    left:          50%;
    width:         130%;
    height:        130%;
    transform:     translate(-50%, -50%);
    pointer-events:none;
    user-select:   none;
    z-index:       2;
}

/* ── 作者卡片头像框 ───────────────────────────────────────── */
/* 尺寸跟 profile.css 的 .moe-author-card-avatar (52px) 对齐 */
/* 容器强制圆形 + overflow:hidden，确保任何比例的自定义头像都被裁成正圆，与圆形头像框对齐 */
.moe-author-card-avatar-box {
    position:        relative;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    width:           52px;
    height:          52px;
    line-height:     0;
    overflow:        visible;
}
.moe-author-card-avatar-box .moe-author-card-avatar {
    display:       block;
    width:         100%;
    height:        100%;
    object-fit:    cover;
    border-radius: 50%;
    box-sizing:    border-box;
}
.moe-author-card-frame {
    position:      absolute;
    top:           50%;
    left:          50%;
    width:         130%;
    height:        130%;
    transform:     translate(-50%, -50%);
    pointer-events:none;
    user-select:   none;
    z-index:       2;
}
.moe-author-card-name .moe-title-badge.moe-title-sm {
    margin-left: 6px;
    vertical-align: 1px;
}

/* ── 商店样式 ────────────────────────────────────────────── */
.moe-shop-wrap {
    max-width:     720px;
    margin:        16px auto;
    padding:       20px;
    background:    linear-gradient(180deg,#fff 0%,#f5fbff 100%);
    border:        1.5px solid #c8e6f7;
    border-radius: 16px;
    box-shadow:    0 4px 14px rgba(94,179,217,.12);
}
.moe-shop-hint {
    font-size:     13px;
    color:         #3a7aaa;
    margin:        8px 0 16px;
}
.moe-shop-hint strong { color: #1e6fa0; }

.moe-shop-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap:                   14px;
}
.moe-shop-card {
    background:    #fff;
    border:        1.5px solid #e5f2fa;
    border-radius: 12px;
    padding:       14px 12px;
    text-align:    center;
    transition:    all .2s cubic-bezier(.22,.8,.36,1);
    position:      relative;
}
.moe-shop-card:hover {
    transform:  translateY(-2px);
    border-color: #5eb3d9;
    box-shadow: 0 6px 18px rgba(94,179,217,.2);
}
.moe-shop-card.is-owned {
    border-color: #b6e3c5;
    background:   linear-gradient(180deg,#fff 0%,#f4fdf7 100%);
}
.moe-shop-card.is-owned::before {
    content:    '✓';
    position:   absolute;
    top:        6px;
    right:      8px;
    color:      #10b981;
    font-size:  14px;
    font-weight:700;
}

.moe-shop-preview {
    margin: 4px 0 10px;
    min-height: 26px;
}
.moe-shop-frame-preview {
    width:         80px;
    height:        80px;
    margin:        4px auto 10px;
    position:      relative;
    display:       flex;
    align-items:   center;
    justify-content:center;
}
.moe-shop-frame-preview img {
    max-width: 100%;
    max-height:100%;
    object-fit:contain;
}
.moe-shop-name {
    font-size:   14px;
    font-weight: 700;
    color:       #1e6fa0;
    margin-bottom: 8px;
    min-height:  20px;
}
.moe-shop-abilities {
    display:    flex;
    flex-wrap:  wrap;
    gap:        4px;
    margin:     6px 0 10px;
    justify-content:center;
}
.moe-ability-tag {
    display:       inline-block;
    padding:       1px 8px;
    background:    #eaf5fb;
    color:         #1a5d7e;
    border-radius: 8px;
    font-size:     11px;
    cursor:        help;
}
.moe-shop-action {
    display:       flex;
    flex-direction:column;
    align-items:   center;
    gap:           6px;
    min-height:    60px;
    justify-content:flex-end;
}
.moe-cost-line {
    font-size: 13px;
    color:     #3a7aaa;
}
.moe-cost-line s {
    color:       #a4c4d6;
    margin-right:4px;
    font-weight: 400;
}
.moe-cost-line strong { color: #1e6fa0; font-size: 15px; }
.moe-owned-tag {
    color:     #10b981;
    font-size: 12px;
    font-weight:600;
}
.moe-shop-card .moe-btn {
    padding:   6px 16px !important;
    font-size: 12px !important;
}
.moe-btn-ghost {
    background: transparent !important;
    border:     1.5px solid #a4c4d6 !important;
    color:      #3a7aaa !important;
    box-shadow: none !important;
}
.moe-btn-ghost:hover { border-color: #5eb3d9 !important; color: #1e6fa0 !important; }
.moe-empty {
    text-align: center;
    color:      #9ac8e0;
    padding:    24px 0;
    grid-column:1/-1;
}

/* 移动端 */
@media (max-width: 480px) {
    .moe-shop-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .moe-shop-card { padding: 10px 8px; }
}

/* ── 暗色模式支持 ─────────────────────────────────────────── */
body.dark-mode .moe-shop-wrap,
[data-theme="dark"] .moe-shop-wrap {
    background: linear-gradient(180deg,#1a2838 0%,#16202e 100%);
    border-color: rgba(94,179,217,.2);
}
body.dark-mode .moe-shop-card,
[data-theme="dark"] .moe-shop-card {
    background: #1e2d3f;
    border-color: rgba(94,179,217,.15);
}
body.dark-mode .moe-shop-name,
[data-theme="dark"] .moe-shop-name,
body.dark-mode .moe-shop-hint strong,
[data-theme="dark"] .moe-shop-hint strong,
body.dark-mode .moe-cost-line strong,
[data-theme="dark"] .moe-cost-line strong {
    color: #8ed3ed;
}
body.dark-mode .moe-ability-tag,
[data-theme="dark"] .moe-ability-tag {
    background: rgba(94,179,217,.15);
    color: #8ed3ed;
}
