/* =============================================================
   Qi Cultivation — ambient HUD + chapter strip + nav dot
   Fully SELF-CONTAINED: explicit values, scoped selectors, its own
   box-sizing reset. Loads site-wide without touching theme styles.
   ============================================================= */

#qg-hud-root, #qg-hud-root *,
.qg-hud, .qg-hud *, .qg-strip, .qg-strip *, .qg-hud-toast, .qg-hud-toast * {
    box-sizing: border-box;
}
.qg-ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------------- floating HUD ---------------- */
.qg-hud {
    position: fixed; right: 18px; bottom: 18px; z-index: 99990;
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px; line-height: 1.4;
}
.qg-hud-pill {
    position: relative; width: 56px; height: 56px; border-radius: 50%; cursor: pointer; padding: 0;
    border: 2px solid var(--tier, #4f8dff);
    background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tier, #4f8dff) 30%, #14161e), #14161e);
    box-shadow: 0 8px 24px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center;
    transition: transform .18s;
}
.qg-hud-pill:hover { transform: scale(1.08); }
.qg-hud-ring { position: absolute; inset: -2px; width: 60px; height: 60px; transform: rotate(-90deg); }
.qg-ring-bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 3; }
.qg-ring-fg { fill: none; stroke: var(--tier, #4f8dff); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.qg-hud-gem { font-size: 22px; color: #fff; line-height: 1; z-index: 1; }
.qg-hud-dot { position: absolute; top: 1px; right: 1px; width: 13px; height: 13px; border-radius: 50%; background: #ff3b3b; border: 2px solid #14161e; animation: qg-dot 1.6s infinite; }
@keyframes qg-dot { 0% { box-shadow: 0 0 0 0 rgba(255,59,59,.6); } 70% { box-shadow: 0 0 0 9px rgba(255,59,59,0); } 100% { box-shadow: 0 0 0 0 rgba(255,59,59,0); } }
.qg-has-claim { animation: qg-pill-glow 2.4s ease-in-out infinite; }
@keyframes qg-pill-glow { 0%,100% { box-shadow: 0 8px 24px rgba(0,0,0,.4); } 50% { box-shadow: 0 8px 24px rgba(0,0,0,.4), 0 0 20px var(--tier, #4f8dff); } }

.qg-hud-panel {
    width: 296px; max-width: calc(100vw - 36px);
    background: #171a22; color: #e6e8ee; border: 1px solid #2a2f3a; border-left: 4px solid var(--tier, #4f8dff);
    border-radius: 14px; padding: 15px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
    transform-origin: bottom right; transform: scale(.6) translateY(20px); opacity: 0; pointer-events: none;
    transition: transform .22s cubic-bezier(.2,.9,.3,1.2), opacity .22s;
}
.qg-hud-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.qg-hud-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.qg-hud-gem2 { font-size: 24px; color: var(--tier, #4f8dff); line-height: 1; }
.qg-hud-realm { font-weight: 800; font-size: 15px; }
.qg-hud-realm .qg-hanzi { font-family: Georgia, serif; opacity: .8; font-weight: 400; }
.qg-hud-sub { font-size: 11.5px; color: #99a0ae; margin-top: 2px; }
.qg-hud-ready { color: #f4c95d; }
.qg-hud-close { margin-left: auto; background: none; border: none; color: #99a0ae; font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.qg-hud-bar { height: 8px; border-radius: 999px; background: #1e222c; overflow: hidden; margin-bottom: 10px; }
.qg-hud-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--tier, #4f8dff), #f4c95d); transition: width .6s; }
.qg-hud-wallet { font-size: 13px; color: #c7ccd6; margin-bottom: 10px; display: flex; align-items: center; }
.qg-hud-dev { font-size: 12px; color: #e5533c; font-weight: 700; margin-bottom: 10px; }
.qg-hud-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.qg-hud-reset { font-size: 11px; color: #99a0ae; margin-bottom: 8px; }
.qg-hud-full { display: block; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--tier, #4f8dff); text-decoration: none; padding-top: 8px; border-top: 1px solid #2a2f3a; }

/* HUD buttons (scoped so they never collide with theme or hub buttons) */
.qg-hud .qg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    background: #4f8dff; color: #fff; border: none; border-radius: 999px;
    padding: 7px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none; transition: filter .15s;
}
.qg-hud .qg-btn:hover { filter: brightness(1.08); }
.qg-hud .qg-btn:disabled { opacity: .5; cursor: default; }
.qg-hud .qg-btn--danger { background: #e5533c; }
.qg-hud .qg-btn--gold { background: #f4c95d; color: #2a1e00; }

.qg-hud-toast {
    position: fixed; bottom: 88px; right: 18px; z-index: 99991; max-width: 320px;
    background: #171a22; color: #e6e8ee; border: 1px solid #2a2f3a; border-left: 4px solid #35c496;
    padding: 11px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.45);
    opacity: 0; transform: translateY(12px); transition: .3s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.qg-hud-toast.show { opacity: 1; transform: none; }
.qg-hud-toast.qg-toast--bad { border-left-color: #e5533c; }
.qg-hud-toast.qg-toast--epic { border-left-color: #f4c95d; }

/* ---------------- static chapter strip (below content, never floats) ---------------- */
.qg-strip {
    margin: 26px 0 8px; padding: 16px 18px; border-radius: 14px;
    background: #14161e; color: #e6e8ee; border: 1px solid #2a2f3a; border-left: 4px solid var(--tier, #f4c95d);
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.qg-strip-ico { font-size: 30px; color: #f4c95d; }
.qg-strip-txt { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.qg-strip-txt b { font-size: 14.5px; }
.qg-strip-txt span { font-size: 12.5px; color: #99a0ae; }
.qg-strip-realm { display: flex; align-items: center; gap: 10px; flex: 1 1 180px; }
.qg-strip-gem { font-size: 26px; color: var(--tier, #f4c95d); }
.qg-strip-realm b { font-size: 15px; }
.qg-strip-sub { display: block; font-size: 12px; color: #99a0ae; margin-top: 1px; }
.qg-strip-bar { flex: 1 1 140px; height: 8px; border-radius: 999px; background: #1e222c; overflow: hidden; min-width: 120px; }
.qg-strip-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--tier, #f4c95d), #f4c95d); }
.qg-strip-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qg-strip-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: #4f8dff; color: #fff; border: none; border-radius: 999px; padding: 9px 16px;
    font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; transition: filter .15s;
}
.qg-strip-btn:hover { filter: brightness(1.08); color: #fff; }
.qg-strip-btn:disabled { opacity: .5; }
.qg-strip-btn--gold { background: #f4c95d; color: #2a1e00; }
.qg-strip-btn--gold:hover { color: #2a1e00; }
.qg-strip-btn--danger { background: #e5533c; }
.qg-strip-btn--ghost { background: transparent; border: 1px solid #2a2f3a; color: #c7ccd6; }
.qg-strip-btn--ghost:hover { color: #fff; }
.qg-strip-done { color: #35c496; font-weight: 700; font-size: 13px; }

/* nav menu dot */
.qg-menu-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff3b3b; margin-left: 4px; vertical-align: super; animation: qg-dot 1.6s infinite; }

@media (max-width: 600px) {
    .qg-hud { right: 12px; bottom: 12px; }
    .qg-hud-pill { width: 50px; height: 50px; }
    .qg-strip { flex-direction: column; align-items: stretch; }
    .qg-strip-actions { justify-content: stretch; }
    .qg-strip-btn { flex: 1; }
}

/* reading toast (from qg-reader.js) — small, brief, non-blocking */
.qg-rtoast {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(16px); z-index: 99992;
    display: flex; align-items: center; gap: 10px; max-width: 90vw;
    background: rgba(20,22,30,.97); color: #fff; border: 1px solid rgba(255,255,255,.12); border-left: 4px solid #f4c95d;
    padding: 10px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 28px rgba(0,0,0,.45);
    opacity: 0; transition: .3s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.qg-rtoast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.qg-rtoast .qg-rt-ic { display: inline-flex; }
.qg-rtoast--treasure { border-left-color: #f4c95d; }


.qg-hud-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #2a2f3a;
}
.qg-hud-full {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--tier, #4f8dff);
    text-decoration: none;
}
.qg-hud-hide {
    background: transparent !important;
    border: 1px solid #2a2f3a !important;
    color: #99a0ae !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
}
.qg-hud-hide:hover {
    color: #e5533c !important;
    border-color: #e5533c !important;
}