/* ==========================================================================
   COMPONENTS — top navigation, panels, stats, rarity, modals, toasts, skeletons…
   ========================================================================== */

/* ---- Top navigation ------------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(6, 6, 7, .94); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: var(--wrap); margin: 0 auto; height: var(--nav-h); padding: 0 1.4rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .6rem; font: 400 1.9rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #fff; justify-self: start; }
.logo:hover { color: #fff; }
.logo-mark { width: 30px; height: 30px; display: grid; place-items: center; background: linear-gradient(135deg, #ffd98a, var(--orange)); color: #1a1100; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.logo-mark .ico { width: 14px; height: 14px; stroke-width: 2.4; }
.nav { display: flex; gap: .2rem; justify-self: center; }
.nav > a, .nav summary { position: relative; display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .9rem; height: var(--nav-h); color: #a3a3ad; font: 700 .72rem/1 var(--body); letter-spacing: .13em; text-transform: uppercase; cursor: pointer; list-style: none; transition: color .2s; }
.nav summary::-webkit-details-marker { display: none; }
.nav > a:hover, .nav summary:hover, .nav details[open] summary { color: #fff; }
.nav > a.on { color: #fff; }
.nav > a.on::after { content: ""; position: absolute; left: .9rem; right: .9rem; bottom: -1px; height: 2px; background: linear-gradient(90deg, #ffd98a, var(--orange)); }
.nav .ico { width: 15px; height: 15px; }
.nav .alert-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin: -8px 0 0 -3px; }
.hud { display: flex; align-items: center; gap: .55rem; justify-self: end; }
.hud-box { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 999px; background: #0b0b0e; padding: .1rem .35rem; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .75rem; font: 800 .86rem/1 var(--body); }
.pill + .pill { border-left: 1px solid var(--line); }
.pill .ico { width: 1.15em; height: 1.15em; }
.pill.gold .ico { color: var(--gold); } .pill.gem .ico { color: var(--orange); } .pill.energy .ico { color: #ffe066; }
.pill small { color: var(--muted); font-weight: 600; }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; color: #cfcfd6; cursor: pointer; list-style: none; border-radius: 50%; transition: color .2s, background .2s; }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.avatar-btn { width: 38px; height: 38px; padding: 0; }
.avatar-btn .avatar { width: 36px; height: 36px; }
.avatar-btn::after { content: ""; position: absolute; top: 0; right: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }

.drop { position: relative; }
.drop-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: .5rem; border-radius: 3px; background: #111114; border: 1px solid var(--line2); box-shadow: 0 20px 50px rgba(0, 0, 0, .7); animation: pop .18s var(--ease); z-index: 60; text-align: left; }
.nav .drop-menu { left: 0; right: auto; top: calc(100% - 4px); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.drop-menu a, .drop-menu button { display: flex; width: 100%; align-items: center; gap: .65rem; padding: .62rem .7rem; border: 0; background: none; color: #e8e8ee; font: 600 .86rem var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; text-align: left; height: auto; }
.drop-menu a:hover, .drop-menu button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.drop-menu hr { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }
.drop-head { padding: .5rem .7rem .6rem; font: 700 .66rem var(--body); text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.notif { display: flex; gap: .7rem; padding: .6rem .7rem; font-size: .86rem; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif .ico { color: var(--gold); margin-top: 2px; }
.notif small { color: var(--muted); display: block; }

/* ---- Mobile tab bar ------------------------------------------------------------- */
.tabbar { display: none; }
@media (max-width: 1240px) {
    .pill.energy { padding-inline: .6rem; } .nav { gap: 0; }
    .nav > a, .nav summary { padding: .5rem .55rem; letter-spacing: .08em; }
    .topbar-in { gap: .5rem; padding: 0 1rem; }
}
@media (max-width: 1140px) {
    .nav { display: none; }
    .topbar-in { grid-template-columns: 1fr auto; }
    .tabbar { position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom)); background: rgba(6, 6, 7, .97); border-top: 1px solid var(--line2); }
    .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .45rem 0; font: 700 .58rem var(--body); letter-spacing: .1em; text-transform: uppercase; color: #8e8e99; }
    .tabbar a .ico { width: 21px; height: 21px; }
    .tabbar a.on { color: var(--gold); }
}
@media (max-width: 640px) {
    .topbar-in { padding: 0 .8rem; }
    .logo { font-size: 1.6rem; }
    .pill { padding: .4rem .5rem; font-size: .78rem; } .pill.energy { display: none; }
    .drop-menu { position: fixed; left: 10px; right: 10px; top: calc(var(--nav-h) + 4px); min-width: 0; }
}

/* ---- Panels & headings ------------------------------------------------------------- */
.panel { position: relative; padding: 1.4rem; border-radius: 3px; background: var(--panel); border: 1px solid var(--line); }
.panel.glow { border-color: rgba(245, 181, 61, .45); box-shadow: 0 0 36px rgba(245, 181, 61, .07); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-title h2, .panel-title h3 { margin: 0; }
.page-head { margin-bottom: .4rem; }
.page-head p { color: var(--muted); max-width: 46rem; margin: .5rem 0 0; }
.kicker { display: inline-block; color: var(--orange); text-transform: uppercase; letter-spacing: .2em; font: 800 .68rem/1 var(--body); margin: 0 0 .7rem; }
.kicker::before { content: "✦ "; }

/* preview-data marker: slim and unmistakable */

/* ---- Stat tiles -------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.stat { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); transition: border-color .25s, transform .25s var(--ease); }
.stat:hover { border-color: var(--accent, var(--gold)); transform: translateY(-2px); }
.stat-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--accent, var(--gold)); background: color-mix(in srgb, var(--accent, var(--gold)) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 35%, transparent); }
.stat-ico .ico { width: 22px; height: 22px; }
.stat b { display: block; font: 400 2rem/1 var(--display); letter-spacing: .02em; }
.stat span { color: var(--muted); font: 700 .64rem var(--body); text-transform: uppercase; letter-spacing: .14em; }
.stat small { display: block; color: var(--muted); font-size: .76rem; }

/* ---- Avatars, badges, rarity tags ----------------------------------------------------- */
.avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; font: 400 1.3rem/1 var(--display); color: #14101c; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 1rem; }
.avatar.lg { width: 92px; height: 92px; font-size: 2.8rem; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px rgba(255, 255, 255, .25); }
.av-violet { background: linear-gradient(135deg, #c7a0ff, #7a3cff); } .av-pink { background: linear-gradient(135deg, #ffa5cf, #ff4f9a); }
.av-gold { background: linear-gradient(135deg, #ffe58a, #f0a500); } .av-cyan { background: linear-gradient(135deg, #a0ecff, #20b4f0); }
.av-green { background: linear-gradient(135deg, #9af0c8, #22b97a); } .av-red { background: linear-gradient(135deg, #ff9aa8, #ff3f5c); }
.av-blue { background: linear-gradient(135deg, #a9c1ff, #4a78f5); } .av-slate { background: linear-gradient(135deg, #d6dbe8, #8e98b3); }
.swatches { display: flex; gap: .6rem; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; }
.swatch .avatar { cursor: pointer; transition: transform .2s var(--ease); }
.swatch:hover .avatar { transform: scale(1.08); }
.swatch input:checked + .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold); }
.swatch input:focus-visible + .avatar { outline: 2px solid var(--cyan); outline-offset: 5px; }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: 3px 8px; font: 800 .62rem/1.2 var(--body); text-transform: uppercase; letter-spacing: .12em; border: 1px solid var(--line2); border-radius: 2px; color: #cfcfd6; }
.badge-admin { color: var(--gold); border-color: var(--gold); background: rgba(245, 181, 61, .08); }
.badge-banned, .badge-loss { color: var(--red); border-color: var(--red); background: rgba(255, 61, 87, .08); }
.badge-win { color: var(--green); border-color: var(--green); background: rgba(61, 220, 132, .08); }
.badge-soon { color: var(--orange); border-color: rgba(255, 122, 26, .5); background: rgba(255, 122, 26, .07); }

.rarity { --c1: #c07a3e; display: inline-flex; align-items: center; gap: .5rem; font: 800 .68rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--c1) 70%, #fff); }
.rarity i { min-width: 1.9rem; padding: .28rem .4rem; text-align: center; font: italic 800 .7rem/1 var(--body); letter-spacing: .04em; color: #14100a; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.rarity.big { font-size: .8rem; } .rarity.big i { font-size: .85rem; padding: .4rem .6rem; }
.rarity.compact { gap: .4rem; }

/* ---- Progress ---------------------------------------------------------------------------- */
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; background: #1d1d23; overflow: hidden; display: block; border-radius: 3px; }
progress::-webkit-progress-bar { background: #1d1d23; border-radius: 3px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #ffd98a, var(--orange)); border-radius: 3px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #ffd98a, var(--orange)); border-radius: 3px; }
progress.atk::-webkit-progress-value { background: linear-gradient(90deg, #ff7a3d, #ff3d57); } progress.atk::-moz-progress-bar { background: #ff5a4a; }
progress.def::-webkit-progress-value { background: linear-gradient(90deg, #46d6ff, #4a78f5); } progress.def::-moz-progress-bar { background: #46b4ff; }
progress.hp::-webkit-progress-value { background: linear-gradient(90deg, #3ddc84, #22b97a); } progress.hp::-moz-progress-bar { background: #3ddc84; }
progress.spd::-webkit-progress-value { background: linear-gradient(90deg, #ffe066, #f5b53d); } progress.spd::-moz-progress-bar { background: #f5b53d; }

/* ---- Tabs, chips, pagination ----------------------------------------------------------------- */
.tabs { display: inline-flex; gap: 0; border: 1px solid var(--line2); border-radius: 2px; flex-wrap: wrap; overflow: hidden; }
.tabs a { padding: .6rem 1.1rem; color: #a3a3ad; font: 700 .7rem var(--body); letter-spacing: .13em; text-transform: uppercase; border-right: 1px solid var(--line); }
.tabs a:last-child { border-right: 0; }
.tabs a:hover { color: #fff; background: #17171c; }
.tabs a.on { color: #1a1100; background: linear-gradient(180deg, #ffe0a0, #f2b53f); }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.6rem; }

/* ---- Tables ------------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .8rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table th { color: var(--muted); font: 700 .62rem var(--body); text-transform: uppercase; letter-spacing: .16em; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Modal: CSS-only (open: href="#id"  close: href="#!") ------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 1rem; }
.modal:target { display: grid; }
.modal-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .82); animation: fade .2s; }
.modal-box { position: relative; width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 1.6rem; border-radius: 3px; background: #101013; border: 1px solid rgba(245, 181, 61, .5); box-shadow: 0 30px 90px rgba(0, 0, 0, .8); animation: pop .25s var(--ease); }
.modal-box.wide { width: min(760px, 100%); }
.modal-x { position: absolute; top: .8rem; right: .8rem; width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); }
.modal-x:hover { color: #fff; border-color: var(--gold); }
.modal-box h2 { padding-right: 2.5rem; }
.modal-foot { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Notifications (toasts) ------------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 120; top: calc(var(--nav-h) + 12px); right: 14px; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast-off { position: absolute; opacity: 0; pointer-events: none; }
.toast { --tc: var(--cyan); pointer-events: auto; display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem; background: #111114; border: 1px solid var(--line2); border-left: 3px solid var(--tc); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); animation: toast-in .4s var(--ease) both, toast-out .4s 7s forwards; }
.toast.success { --tc: var(--green); } .toast.error { --tc: var(--red); } .toast.info { --tc: var(--gold); }
.toast .ico { color: var(--tc); margin-top: 2px; }
.toast p { margin: 0; flex: 1; font-size: .9rem; }
.toast label { cursor: pointer; color: var(--muted); }
.toast label:hover { color: #fff; }
.toast-off:checked + .toast { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
.alert { padding: .75rem 1rem; border: 1px solid var(--line2); border-left: 3px solid var(--red); background: rgba(255, 61, 87, .07); margin-bottom: 1rem; font-size: .9rem; }

/* ---- Loading (skeleton shimmer: transform only) -------------------------------------------------------- */
.skeleton { position: relative; overflow: hidden; background: #17171c; min-height: 1rem; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent); animation: shimmer 1.5s infinite; }
.skeleton.line { height: .8rem; margin: .5rem 0; border-radius: 2px; } .skeleton.line.short { width: 55%; }
.skeleton.circle { border-radius: 50%; width: 42px; height: 42px; flex: none; }
.skeleton.card { aspect-ratio: 5/7; border-radius: 6px; width: 100%; border: 1px dashed var(--line2); background: #0e0e11; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-row { display: flex; gap: .9rem; align-items: center; padding: .55rem 0; }
.skel-row > div:last-child { flex: 1; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .ico { width: 38px; height: 38px; margin-bottom: .6rem; opacity: .6; }

/* ---- Auth ------------------------------------------------------------------------------------------------------ */
.auth-wrap { min-height: calc(100vh - var(--nav-h) - 9rem); display: grid; place-items: center; }
.auth-card { width: min(430px, 100%); }
.facts { display: flex; gap: 2.2rem; margin: 1rem 0; flex-wrap: wrap; }
.facts dt { color: var(--muted); font: 700 .62rem var(--body); text-transform: uppercase; letter-spacing: .16em; }
.facts dd { margin: 0; font-weight: 700; }

/* small phones: the logo shows only its mark so gold, gems, cart, bell and avatar fit on one row */
@media (max-width: 480px) {
    .logo-text { display: none; }
    .topbar-in { gap: .3rem; }
    .hud { gap: .25rem; }
    .hud-box { padding-inline: .15rem; }
}

/* wallet bar: keep the stamina "10 /10" on one centred baseline and inside the pill */
.hud-box { overflow: hidden; padding: .1rem .2rem; }
.pill { line-height: 1; }
.pill.energy { gap: .3rem; padding-inline: .7rem .6rem; }
.pill small { font-size: .72em; line-height: 1; align-self: center; }

progress.satk::-webkit-progress-value { background: linear-gradient(90deg, #d0b0ff, #9a63ff); } progress.satk::-moz-progress-bar { background: #b78bff; }
progress.sdef::-webkit-progress-value { background: linear-gradient(90deg, #7ff0dc, #22b9a6); } progress.sdef::-moz-progress-bar { background: #3fd6c4; }
progress { height: 8px; }
.pfx{color:#9ee6b8;font-weight:600}
.bt-pas .pas-off{opacity:.55}.pas-state{font-weight:700;margin-left:.3em}.pas-on .pas-state{color:#9ee6b8}

/* top-right wallet: every figure sits on one centred line, the "/10" stays on the number's baseline */
.hud-box .pill { align-items: center; line-height: 1; }
.hud-box .pill > span { display: inline-block; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-box .pill .val { display: inline-flex; align-items: baseline; gap: .15em; }
.hud-box .pill small { align-self: auto; font-size: .72em; }
.hud-box .pill .ico { vertical-align: 0; }

/* profile pictures from cards, pickers, banner */
.avatar.has-art { padding: 0; overflow: hidden; background: #000; } .avatar.has-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .6rem; max-height: 340px; overflow: auto; padding: .3rem; }
.pick { position: relative; display: block; cursor: pointer; } .pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-in { display: grid; gap: .25rem; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); transition: border-color .15s, transform .15s; }
.pick-in img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; display: block; } .pick-in small { padding: 0 .4rem .4rem; font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-none { place-items: center; aspect-ratio: 5 / 7; font: 400 2.4rem var(--display); align-content: center; }
.pick:hover .pick-in { transform: translateY(-2px); } .pick input:checked + .pick-in { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); } .pick input:focus-visible + .pick-in { outline: 2px solid var(--cyan); outline-offset: 2px; }
.profile-banner { position: relative; overflow: hidden; isolation: isolate; } .profile-banner .pb-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; opacity: .35; filter: blur(2px); z-index: -2; }
.profile-banner.has-banner::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(8, 8, 12, .85), rgba(8, 8, 12, .35)); }

/* attack preview on the card page */
.atk-prev { margin-top: .5rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .03); }
.atk-prev summary { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; cursor: pointer; font-weight: 700; font-size: .85rem; list-style: none; } .atk-prev summary::-webkit-details-marker { display: none; }
.atk-prev summary .ico { width: 15px; height: 15px; color: var(--gold); } .atk-prev[open] summary { border-bottom: 1px solid var(--line); }
.atk-body { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 1rem; padding: .8rem; align-items: start; }
.atk-stage { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; background: #0a0a12; border: 1px solid var(--line); }
@media (max-width: 640px) { .atk-body { grid-template-columns: minmax(0, 1fr); } }
.avatar.has-art svg { width: 100%; height: 100%; display: block; }
.profile-banner .pb-art svg, .profile-banner .pb-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-in svg { width: 100%; aspect-ratio: 5 / 7; display: block; }

/* ---- phones: tighter chrome, 2-column stat cards ---- */
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .stats > * { padding: .6rem .7rem; min-width: 0; }
  .stat { gap: .6rem; } .stat b { font-size: 1.5rem; } .stat-ico { flex: none; }
  .page-head { gap: .5rem; }
  .tut-banner { padding: .35rem .7rem; font-size: .78rem; gap: .3rem .6rem; }
  .tut-banner .btn { min-height: 0; padding: .3rem .6rem; }
  .profile-banner { padding: 1rem; }
}
