/* ============================================================
 *  ju-bounce.css · 弹跳小老虎挂件
 *  去 Wallpaper Engine 化，独立于项目主题
 * ============================================================ */

#ju-bounce-root {
    /* 默认全屏；data-mode="widget" 时改为右下角 */
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    overflow: hidden;
    font-family: monospace;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#ju-bounce-root[data-mode="widget"] {
    inset: auto 12px 12px auto;
    width: 380px;
    height: 300px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

/* 小老虎本体 */
#jufufu {
    position: absolute;
    width: 150px;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    will-change: left, top;
    transition: filter 0.15s;
}

/* 分数统计条 */
.ju-stats {
    position: absolute;
    top: 40px;
    left: 24px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    font-size: 1rem;
    color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: 998;
    transition: background 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

/* 左下角容器（音量） */
#ju-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform-origin: bottom left;
    pointer-events: auto;
    z-index: 999;
}

/* 右下角（Chaos 按钮） */
#ju-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    transform-origin: bottom right;
    pointer-events: auto;
    z-index: 999;
}

/* 右上角（开发者按钮） */
#ju-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    transform-origin: top right;
    pointer-events: auto;
    z-index: 999;
}

/* Chaos 按钮 */
#chaos-toggle {
    padding: 10px 15px;
    background: #ffb3c1;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-family: inherit;
    font-size: clamp(11px, 1.6vmin, 15px);
    cursor: pointer;
    outline: none;
    transition: transform 0.15s;
}
#chaos-toggle:hover { transform: translateY(-1px); }
#chaos-toggle:active { transform: scale(0.96); }

/* 开发者按钮（切换隐藏 UI） */
#ju-dev-disable {
    padding: 6px 14px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
}
#ju-dev-disable:hover { opacity: 0.7; }

/* 音量控制面板 */
#ju-volume-control {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.13);
    transition: box-shadow 0.2s;
    animation: juPopIn 0.5s cubic-bezier(.5, 1.8, .5, 1) 0.2s 1 both;
}
#ju-volume-control:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

#volume-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    cursor: pointer;
    transition: filter 0.2s;
    display: block;
}
#volume-icon:active { filter: brightness(0.8); }

#ju-volume-sliders {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: #444;
}
#ju-volume-sliders label {
    margin-bottom: -2px;
    font-family: inherit;
}

/* 滑块 */
#volume-slider-bgm,
#volume-slider-sfx {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 140px;
    background: linear-gradient(90deg, #ffb3c1 0%, #fee1a7 100%);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
#volume-slider-bgm::-webkit-slider-thumb,
#volume-slider-sfx::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    background: url("img/jufuSlider.png") no-repeat center center;
    background-size: contain;
    border: none;
    margin-top: -10px;
    cursor: grab;
}
#volume-slider-bgm::-moz-range-thumb,
#volume-slider-sfx::-moz-range-thumb {
    width: 32px;
    height: 32px;
    background: url("img/jufuSlider.png") no-repeat center center;
    background-size: contain;
    border: none;
    cursor: grab;
}

@keyframes juPopIn {
    0%   { transform: scale(0.7) translateY(30px); opacity: 0; }
    80%  { transform: scale(1.08) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* 移动端小屏：把音量面板缩一点 */
@media (max-width: 600px) {
    #ju-volume-control { padding: 8px 12px; gap: 12px; }
    #volume-icon { width: 40px; height: 40px; }
    #volume-slider-bgm, #volume-slider-sfx { width: 110px; }
    .ju-stats { font-size: 0.85rem; padding: 4px 10px; top: 20px; left: 12px; }
}
/* ============================================================
 *  大小控制面板
 * ============================================================ */
#ju-size-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.13);
    font-size: 0.8rem;
    color: #444;
    transition: box-shadow 0.2s;
    animation: juPopIn 0.5s cubic-bezier(.5, 1.8, .5, 1) 0.15s 1 both;
}
#ju-size-control:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

#ju-size-control label {
    font-family: inherit;
    white-space: nowrap;
    font-weight: 500;
}

#size-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 170px;
    background: linear-gradient(90deg, #a8e6cf 0%, #ffb3c1 50%, #fee1a7 100%);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
#size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    background: url("img/jufuSlider.png") no-repeat center center;
    background-size: contain;
    border: none;
    margin-top: -8px;
    cursor: grab;
}
#size-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    background: url("img/jufuSlider.png") no-repeat center center;
    background-size: contain;
    border: none;
    cursor: grab;
}

#size-value {
    min-width: 46px;
    text-align: right;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

/* 移动端小屏 */
@media (max-width: 600px) {
    #ju-size-control { padding: 8px 12px; gap: 8px; }
    #size-slider { width: 120px; }
    #size-value { min-width: 38px; font-size: 0.78rem; }
}
/* ============================================================
 *  排行榜按钮 + 弹窗
 * ============================================================ */

/* 右上角排行榜按钮（和 × 按钮并排） */
#ju-top-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

#ju-leaderboard-btn {
    padding: 6px 14px;
    background: #f8c850;
    color: #4a3300;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.15s;
}
#ju-leaderboard-btn:hover { opacity: 1; }
#ju-leaderboard-btn:active { transform: scale(0.96); }

/* 弹窗遮罩 */
#ju-lb-mask {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 14, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: auto;
}
#ju-lb-mask.show { display: flex; }

/* 弹窗本体 */
#ju-lb-box {
    width: 440px;
    max-width: 100%;
    max-height: 80vh;
    background: #fffdf6;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: juLbIn 0.28s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes juLbIn {
    from { transform: translateY(16px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

#ju-lb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #fff8e1 0%, #fffdf6 100%);
}
#ju-lb-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #4a3300;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#ju-lb-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    color: #666;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}
#ju-lb-close:hover { background: #f0f0f0; color: #333; }

#ju-lb-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
}
#ju-lb-list::-webkit-scrollbar { width: 6px; }
#ju-lb-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.ju-lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    transition: background 0.15s;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ju-lb-row:hover { background: rgba(0, 0, 0, 0.03); }
.ju-lb-row.is-me {
    background: rgba(248, 200, 80, 0.15);
    border-left: 3px solid #f8c850;
}
.ju-lb-rank {
    width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #888;
    flex-shrink: 0;
}
.ju-lb-rank.top1 { color: #d4a017; font-size: 1.1rem; }
.ju-lb-rank.top2 { color: #8a9099; font-size: 1.05rem; }
.ju-lb-rank.top3 { color: #b87333; font-size: 1.05rem; }
.ju-lb-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
}
.ju-lb-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ju-lb-score {
    flex-shrink: 0;
    font-weight: 700;
    color: #d4a017;
    font-size: 0.95rem;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
}

#ju-lb-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.88rem;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (max-width: 600px) {
    #ju-lb-box { max-height: 85vh; }
    #ju-lb-head { padding: 12px 16px; }
    .ju-lb-row { padding: 8px 14px; gap: 10px; }
    .ju-lb-avatar { width: 32px; height: 32px; }
    .ju-lb-rank { width: 30px; font-size: 0.88rem; }
    .ju-lb-name { font-size: 0.85rem; }
    .ju-lb-score { font-size: 0.88rem; }
}
/* 排行榜底部登录提示条 */
#ju-lb-login-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff8e1;
    font-size: 0.82rem;
    color: #8a6d1f;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#ju-lb-login-bar a {
    color: #d4a017;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
#ju-lb-login-bar a:hover { text-decoration: underline; }
/* ============================================================
 *  右上角登录按钮 / 用户昵称
 * ============================================================ */
#ju-login-btn {
    padding: 6px 14px;
    background: #7caee0;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.15s;
}
#ju-login-btn:hover  { opacity: 1; }
#ju-login-btn:active { transform: scale(0.96); }

#ju-user-badge {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.85);
    color: #4a3300;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ============================================================
 *  v2 · 退出按钮 + 内嵌登录区 + Toast
 * ============================================================ */

/* 右上角退出按钮 */
#ju-logout-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.85);
    color: #b85c5c;
    border: 1px solid rgba(184, 92, 92, 0.35);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
#ju-logout-btn:hover {
    background: rgba(184, 92, 92, 0.1);
    border-color: rgba(184, 92, 92, 0.6);
}
#ju-logout-btn:active {
    transform: scale(0.96);
}

/* 排行榜弹窗底部登录区 */
#ju-lb-login-box {
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #fffdf6 0%, #fff8e1 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.ju-lb-login-title {
    font-size: 0.84rem;
    color: #8a6d1f;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#ju-lb-login-box input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    width: 100%;
}
#ju-lb-login-box input:focus {
    border-color: #d4a017;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}
#ju-lb-login-btn {
    height: 38px;
    background: #f8c850;
    color: #4a3300;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
#ju-lb-login-btn:hover:not(:disabled) { background: #f5b830; }
#ju-lb-login-btn:active:not(:disabled) { transform: scale(0.98); }
#ju-lb-login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ju-lb-login-tip {
    font-size: 0.78rem;
    text-align: center;
    min-height: 1em;
    color: transparent;
    transition: color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ju-lb-login-tip.show.error   { color: #c0392b; }
.ju-lb-login-tip.show.success { color: #27ae60; }

/* Toast */
.ju-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 10px 22px;
    background: #fff;
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 0.9rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 80vw;
}
.ju-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ju-toast.error   { border-left: 4px solid #c0392b; color: #c0392b; }
.ju-toast.success { border-left: 4px solid #27ae60; color: #27ae60; }

/* 移动端 */
@media (max-width: 600px) {
    #ju-lb-login-box { padding: 12px 14px 14px; }
    .ju-lb-login-title { font-size: 0.8rem; }
}