/* Physical-item RPG components. Namespaced .rpg-*, self-contained, so the same
   file renders on challengetube.com, collecttube.com and exptube.com/i/. */
.rpg {
  --rpg-ink: #14161c; --rpg-muted: #646a76; --rpg-line: #e6e8ee; --rpg-card: #ffffff; --rpg-soft: #f6f7fa;
  --rpg-exp: #f2b705; --rpg-exp2: #ffdf5e; --rpg-hp: #e23b3b; --rpg-hp2: #ff7a6b; --rpg-energy: #2f7bff; --rpg-energy2: #7fb2ff;
  --rpg-accent: #e5372b; --rpg-radius: 14px;
  --rpg-common: #9aa3ad; --rpg-uncommon: #3cb371; --rpg-rare: #2f7bff; --rpg-epic: #9b4dff; --rpg-legendary: #ff9f1a;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--rpg-ink);
}
.rpg * { box-sizing: border-box; }
/* Host pages style links globally (EXPtube's are light on dark); pin ours. */
.rpg a { color: var(--rpg-accent); }
.rpg a.rpg-btn { color: #fff; }
.rpg a.rpg-btn--ghost { color: var(--rpg-ink); }
.rpg a.rpg-rank { color: #fff; }
.rpg .rpg-card { color: var(--rpg-ink); }
.rpg-card { background: var(--rpg-card); border: 1px solid var(--rpg-line); border-radius: var(--rpg-radius); padding: 16px; box-shadow: 0 6px 22px rgba(20, 22, 28, .06); }
.rpg-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rpg-title { font: 800 18px/1.2 Poppins, Inter, sans-serif; margin: 0; }
.rpg-sub { color: var(--rpg-muted); font-size: 13px; }
.rpg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rpg-between { justify-content: space-between; }
.rpg-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .rpg-grid--2 { grid-template-columns: 1fr 1fr; } .rpg-grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* level badge */
.rpg-level { position: relative; width: 64px; height: 64px; flex: none; display: grid; place-items: center; }
.rpg-level svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rpg-level b { position: relative; font: 900 22px/1 Poppins, Inter, sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.rpg-level small { position: absolute; top: 6px; font: 800 8px/1 Inter, sans-serif; letter-spacing: .12em; color: #fff8; }

/* bars */
.rpg-bar { margin-top: 10px; }
.rpg-bar__label { display: flex; justify-content: space-between; font: 700 12px/1.4 Inter, sans-serif; color: var(--rpg-muted); letter-spacing: .02em; }
.rpg-bar__label b { color: var(--rpg-ink); }
.rpg-bar__track { position: relative; height: 14px; border-radius: 999px; background: #eceef3; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.12); margin-top: 4px; }
.rpg-bar__fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.rpg-bar__fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 55%); border-radius: inherit; }
.rpg-bar--exp .rpg-bar__fill { background: linear-gradient(90deg, var(--rpg-exp), var(--rpg-exp2)); }
.rpg-bar--hp .rpg-bar__fill { background: linear-gradient(90deg, var(--rpg-hp), var(--rpg-hp2)); }
.rpg-bar--energy .rpg-bar__fill { background: linear-gradient(90deg, var(--rpg-energy), var(--rpg-energy2)); }
.rpg-bar__gain { position: absolute; right: 6px; top: -1px; font: 900 11px/16px Inter, sans-serif; color: #7a5600; opacity: 0; }
.rpg-bar--gain .rpg-bar__gain { animation: rpgGain 2.2s ease-out forwards; }
@keyframes rpgGain { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

/* stats + ranks */
.rpg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.rpg-stat { background: var(--rpg-soft); border-radius: 10px; padding: 10px 12px; }
.rpg-stat__v { font: 900 20px/1.1 Poppins, Inter, sans-serif; }
.rpg-stat__k { font: 600 11px/1.3 Inter, sans-serif; color: var(--rpg-muted); text-transform: uppercase; letter-spacing: .06em; }
.rpg-rank { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #14161c; color: #fff; font: 800 12px/1 Inter, sans-serif; text-decoration: none; }
.rpg-rank i { font-style: normal; color: #ffd75a; }
a.rpg-rank:hover { background: var(--rpg-accent); }

/* achievements */
.rpg-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.rpg-badge { position: relative; width: 64px; text-align: center; font: 700 10px/1.25 Inter, sans-serif; color: var(--rpg-muted); cursor: default; outline: none; }
.rpg-badge svg { width: 56px; height: 64px; display: block; margin: 0 auto 4px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
.rpg-badge--locked svg { filter: grayscale(1) opacity(.35); }

/* MapleStory-style tooltip (hover on desktop, tap on touch) */
.rpg-tip { position: fixed; z-index: 2147483000; min-width: 220px; max-width: 290px; padding: 12px 14px; border-radius: 10px; background: rgba(18, 20, 30, .96); color: #f4f6ff; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 10px 34px rgba(0,0,0,.35); font: 500 12px/1.45 Inter, sans-serif; pointer-events: none; }
.rpg-tip__name { font: 800 14px/1.25 Poppins, Inter, sans-serif; text-align: center; margin-bottom: 2px; }
.rpg-tip__grade { text-align: center; font-size: 11px; opacity: .85; margin-bottom: 8px; }
.rpg-tip hr { border: 0; border-top: 1px dashed rgba(255,255,255,.25); margin: 8px 0; }
.rpg-tip__row { display: flex; justify-content: space-between; gap: 10px; }
.rpg-tip__row span:first-child { opacity: .7; }
.rpg-tip img { display: block; width: 72px; height: 72px; object-fit: contain; margin: 2px auto 6px; image-rendering: auto; }
.rpg-r-common { color: #d7dde4; } .rpg-r-uncommon { color: #73e09b; } .rpg-r-rare { color: #7fb2ff; } .rpg-r-epic { color: #c99bff; } .rpg-r-legendary { color: #ffc35a; }

/* history */
.rpg-history { list-style: none; margin: 8px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--rpg-line); }
.rpg-history li { position: relative; padding: 0 0 14px 6px; }
.rpg-history li::before { content: ""; position: absolute; left: -26px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--rpg-accent); }
.rpg-history li[data-type="ITEM_LEVEL_UP"]::before { border-color: var(--rpg-exp); }
.rpg-history li[data-type="ACHIEVEMENT_UNLOCKED"]::before, .rpg-history li[data-type="RANK_MILESTONE"]::before { border-color: #9b4dff; }
.rpg-history li[data-type="REWARD_REVERSED"]::before { border-color: #646a76; }
.rpg-history time { display: block; font: 700 11px/1.3 Inter, sans-serif; color: var(--rpg-muted); text-transform: uppercase; letter-spacing: .05em; }
.rpg-history b { font-weight: 700; }
.rpg-chain { font: 600 11px/1.3 Inter, sans-serif; color: var(--rpg-muted); }

/* challenge panel */
.rpg-tabs { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.rpg-tab { border: 1px solid var(--rpg-line); background: #fff; border-radius: 999px; padding: 7px 12px; font: 700 12px/1 Inter, sans-serif; cursor: pointer; color: var(--rpg-ink); }
.rpg-tab[aria-selected="true"] { background: var(--rpg-ink); color: #fff; border-color: var(--rpg-ink); }
.rpg-ch { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rpg-line); }
.rpg-ch__t { font: 700 14px/1.3 Inter, sans-serif; }
.rpg-ch__r { font: 600 12px/1.4 Inter, sans-serif; color: var(--rpg-muted); }
.rpg-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font: 800 10px/1.4 Inter, sans-serif; letter-spacing: .04em; text-transform: uppercase; background: var(--rpg-soft); color: var(--rpg-muted); }
.rpg-pill--ok { background: #e7f7ee; color: #157a3e; } .rpg-pill--warn { background: #fff4df; color: #9a5b00; } .rpg-pill--bad { background: #fdeaea; color: #b42318; } .rpg-pill--info { background: #e8f0ff; color: #1d4ed8; }
.rpg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 9px 14px; font: 800 13px/1 Inter, sans-serif; cursor: pointer; text-decoration: none; background: var(--rpg-accent); color: #fff; }
.rpg-btn--ghost { background: #fff; color: var(--rpg-ink); border: 1px solid var(--rpg-line); }
.rpg-btn:disabled { opacity: .55; cursor: default; }

/* collection reveal + loot */
.rpg-stage { position: fixed; inset: 0; z-index: 2147482000; display: grid; place-items: center; background: radial-gradient(800px 500px at 50% 45%, rgba(20,22,40,.55), rgba(8,9,16,.82)); }
.rpg-stage__skip { position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 9px 16px; font: 700 13px/1 Inter, sans-serif; cursor: pointer; }
.rpg-reveal { text-align: center; color: #fff; padding: 20px; max-width: 360px; }
.rpg-reveal__img { width: 180px; height: 180px; object-fit: contain; margin: 0 auto 12px; display: block; filter: drop-shadow(0 12px 30px rgba(255,210,90,.35)); animation: rpgPop .7s cubic-bezier(.2,1.4,.4,1) both; }
.rpg-reveal__tag { display: inline-block; font: 900 12px/1 Inter, sans-serif; letter-spacing: .2em; padding: 7px 12px; border-radius: 999px; background: #ffd75a; color: #3d2a00; animation: rpgPop .5s .25s both; }
.rpg-reveal h2 { font: 900 22px/1.2 Poppins, Inter, sans-serif; margin: 12px 0 4px; }
@keyframes rpgPop { from { opacity: 0; transform: scale(.6) translateY(16px); } to { opacity: 1; transform: none; } }
.rpg-loot-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rpg-drop { position: absolute; left: 0; top: 0; width: 56px; height: 56px; display: grid; place-items: center; will-change: transform, opacity; }
.rpg-drop img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.rpg-drop::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle, var(--glow, rgba(255,255,255,.5)), transparent 70%); animation: rpgPulse 1.2s ease-in-out infinite; }
.rpg-drop[data-r="uncommon"] { --glow: rgba(60,179,113,.75); } .rpg-drop[data-r="rare"] { --glow: rgba(47,123,255,.8); } .rpg-drop[data-r="epic"] { --glow: rgba(155,77,255,.85); } .rpg-drop[data-r="legendary"] { --glow: rgba(255,159,26,.95); }
@keyframes rpgPulse { 50% { transform: scale(1.25); opacity: .6; } }
.rpg-drop__label { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 800 12px/1 Inter, sans-serif; color: #fff; text-shadow: 0 1px 0 #000, 0 0 6px #000; }
.rpg-bag { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); display: grid; place-items: center; }
.rpg-bag svg { width: 40px; height: 40px; }
.rpg-bag--hit { animation: rpgBag .35s ease-out; }
@keyframes rpgBag { 50% { transform: translateX(-50%) scale(1.18); } }
.rpg-receipt { position: absolute; left: 50%; bottom: 168px; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.rpg-receipt span { background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: 6px 10px; font: 700 12px/1 Inter, sans-serif; display: inline-flex; gap: 6px; align-items: center; }
.rpg-receipt img { width: 18px; height: 18px; object-fit: contain; }
.rpg-levelup { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font: 900 34px/1 Poppins, Inter, sans-serif; color: #ffd75a; text-shadow: 0 3px 0 #7a4b00, 0 0 22px rgba(255,200,60,.7); animation: rpgPop .6s both; }
@media (prefers-reduced-motion: reduce) {
  .rpg-bar__fill { transition: none; }
  .rpg-reveal__img, .rpg-reveal__tag, .rpg-levelup { animation: none; }
  .rpg-drop::before { animation: none; }
}
