:root {
  --collector-ease: cubic-bezier(.22,1,.36,1);
  --collector-purple: #9147FF;
  --collector-coral: #FF454F;
}

/* Profile header and viewing statistics */
#profile.komi-profile-studio .profile-header-card[data-profile-hero] { isolation: isolate; }
#profile.komi-profile-studio [data-profile-hero] .profile-cover > img {
  transform: translate3d(calc(var(--komi-glare-x,0%) * .12),calc(var(--komi-glare-y,0%) * .12),0) scale(1.085);
  transition: transform 420ms var(--collector-ease);
}
#profile.komi-profile-studio [data-profile-hero].is-komi-tilt-active .profile-cover > img { transition-duration: 160ms; }
#profile.komi-profile-studio .komi-profile-avatar-halo {
  position: absolute; inset: -4px; border-radius: inherit; pointer-events: none; overflow: hidden;
  border: 1px solid rgb(255 69 79 / .64); box-shadow: 0 0 15px rgb(255 69 79 / .25);
}
#profile.komi-profile-studio [data-profile-hero]:has(.komi-premium-badge) .komi-profile-avatar-halo {
  border-color: transparent; box-shadow: 0 0 20px rgb(145 71 255 / .48), 0 0 12px rgb(255 69 79 / .24);
  mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
  padding: 2px;
}
#profile.komi-profile-studio [data-profile-hero]:has(.komi-premium-badge) .komi-profile-avatar-halo::before {
  content: ""; position: absolute; inset: -25%;
  background: conic-gradient(from 70deg,#9147FF,#FF454F,#9147FF);
  animation: komi-collector-orbit 8s linear infinite;
}
@keyframes komi-collector-orbit { to { transform: rotate(1turn); } }

#profile.komi-profile-studio.komi-profile-premium-mono .komi-profile-insights {
  display: grid; grid-template-columns: minmax(170px,1.6fr) repeat(4,minmax(0,1fr));
  border: 1px solid rgb(255 255 255 / .10); background: rgb(17 17 24 / .84);
  backdrop-filter: blur(12px); gap: 0;
}
#profile.komi-profile-studio.komi-profile-premium-mono .komi-profile-insights .profile-list-meter {
  min-width: 0; align-content: center; padding: 9px clamp(8px,2vw,18px);
}
#profile.komi-profile-studio .profile-insight-track {
  display: block; width: 100%; height: 4px; margin-top: 5px; overflow: hidden;
  border-radius: 999px; background: rgb(255 255 255 / .09);
}
#profile .profile-insight-track i {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,#ff454f,#ff807c);
  transform: scaleX(var(--profile-insight,0)); transform-origin: left;
  transition: transform .65s var(--collector-ease);
  animation: komi-insight-fill .72s var(--collector-ease);
}
#profile .profile-list-meter[data-profile-meter="1"] .profile-insight-track i { background: linear-gradient(90deg,#39b392,#72edbd); }
#profile .profile-list-meter[data-profile-meter="2"] .profile-insight-track i { background: linear-gradient(90deg,#9147FF,#c18dff); }
#profile .profile-list-meter[data-profile-meter="3"] .profile-insight-track i { background: linear-gradient(90deg,#9147FF,#FF454F); }
@keyframes komi-insight-fill { from { transform: scaleX(0); } }
#profile .profile-insight-details {
  grid-column: 1 / -1; display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: end;
  align-items: center; padding: 3px 12px 0; color: #c6c2d0; font-size: 12px;
}
#profile .profile-insight-details button {
  color: inherit; background: transparent; border: 0; padding: 5px 0; min-height: 36px; cursor: pointer;
}
#profile .profile-insight-details button:hover { text-decoration: underline; }
#profile .profile-insight-details strong { color: #f5f2fa; margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 960px) {
  #profile.komi-profile-studio.komi-profile-premium-mono .komi-profile-insights { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #profile.komi-profile-studio.komi-profile-premium-mono .komi-profile-insights > .profile-xp-capsule { grid-column: 1 / -1; }
}
@media (max-width: 590px) {
  #profile.komi-profile-studio.komi-profile-premium-mono .komi-profile-insights { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* People drawer */
#komiFriendsDrawer .komi-drawer-avatar { position: relative; flex: 0 0 auto; align-self: center; line-height: 0; }
#komiFriendsDrawer .komi-drawer-online {
  position: absolute; inset: auto -1px -1px auto; width: 12px; height: 12px;
  border: 2px solid #111118; border-radius: 50%; background: #4add93;
  box-shadow: 0 0 8px #4add9380;
}
#komiFriendsDrawer .komi-drawer-online:not([hidden])::after,
#komiFriendsDrawer :is(.komi-drawer-live-title,.komi-friend-room-live)::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 1px solid currentColor;
  animation: komi-drawer-pulse 1.85s var(--collector-ease) infinite; pointer-events: none;
}
#komiFriendsDrawer .komi-drawer-online:not([hidden])::after { color: #57e6a3; }
@keyframes komi-drawer-pulse { from { transform: scale(.74); opacity: .76; } to { transform: scale(1.85); opacity: 0; } }
#komiFriendsDrawer .komi-friends-person:has(.komi-drawer-live) { flex-wrap: wrap; }
#komiFriendsDrawer .komi-drawer-live {
  flex: 1 0 100%; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 5px;
  padding: 2px 4px 2px 8px; border-radius: 9px; border: 1px solid rgb(145 71 255 / .42);
  background: rgb(145 71 255 / .16); color: #e8d6ff;
}
#komiFriendsDrawer .komi-drawer-live-title {
  position: relative; overflow-wrap: anywhere; padding-inline-start: 13px; font-size: 12px;
}
#komiFriendsDrawer .komi-drawer-live-title::before,
#komiFriendsDrawer .komi-drawer-live-title::after {
  position: absolute; inset: .34em auto auto 0; width: 7px; height: 7px; border-radius: 50%; color: #b583ff;
}
#komiFriendsDrawer .komi-drawer-live-title::before { content: ""; background: #b583ff; }
#komiFriendsDrawer .komi-friend-room-live { position: relative; background: #9147FF; color: #b583ff; box-shadow: 0 0 10px #9147ff99; }
#komiFriendsDrawer .komi-drawer-live .komi-friend-room-join {
  flex: 0 1 auto; min-width: 0; padding: 4px 7px; border-color: #9147FF; background: #291943; color: #fff;
}
@media (hover:hover) and (pointer:fine) {
  #komiFriendsDrawer .komi-drawer-live .komi-friend-room-join {
    opacity: 0; transform: translateX(5px); pointer-events: none; transition: opacity .18s,transform .18s var(--collector-ease);
  }
  #komiFriendsDrawer .komi-friends-person:is(:hover,:focus-within) .komi-drawer-live .komi-friend-room-join {
    opacity: 1; transform: none; pointer-events: auto;
  }
}

/* Opening the existing pack and revealing its confirmed result */
dialog.komi-pack-stage {
  --pack-screen: min(740px,calc(100vw - 24px)); box-sizing: border-box;
  width: var(--pack-screen); max-width: none; max-height: min(90vh,850px); max-height: min(90dvh,850px);
  padding: 0; color: #fff; border: 1px solid rgb(145 71 255 / .5); border-radius: 18px;
  background: #111118; box-shadow: 0 26px 110px #000e, 0 0 30px #9147ff30;
  overscroll-behavior: contain;
}
dialog.komi-pack-stage::backdrop { background: rgb(5 4 10 / .82) !important; backdrop-filter: blur(14px) !important; }
dialog.komi-pack-stage .kc-reel-panel { margin: 0; border: 0; width: 100%; box-sizing: border-box; }
.komi-pack-stage[data-phase="seal"] .kc-foil-object { animation: komi-seal-arrive .64s var(--collector-ease) both; }
@keyframes komi-seal-arrive {
  from { opacity: 0; transform: perspective(1000px) translate3d(0,112px,-180px) rotateZ(-18deg) scale(.58); }
  to { opacity: 1; transform: none; }
}
.komi-pack-stage .kc-real-pick.is-dealing .kc-deal-light { opacity: 1; }
.komi-pack-stage .kc-real-pick.is-dealing .kc-foil-table::after,
.komi-pack-stage .kc-real-pick.is-revealing .kc-pick-burst::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse,#fff8 0,#FF454F55 26%,#9147FF55 48%,transparent 74%);
  opacity: 0; mix-blend-mode: screen;
  animation: komi-pack-glow .82s calc(var(--kc-pick-elapsed,0ms) + .62s) var(--collector-ease) both;
}
.komi-pack-stage .kc-real-pick.is-dealing:not(.kc-quick-pick) .kc-foil-object {
  animation: komi-pack-tension 700ms var(--collector-ease) both;
}
.komi-pack-stage .kc-real-pick.is-revealing .kc-pick-burst::after { animation-delay: calc(var(--kc-pick-elapsed,0ms) + .96s); }
.komi-pack-stage .kc-quick-pick .kc-pick-burst::after { animation-delay: calc(var(--kc-pick-elapsed,0ms) + .22s); }
@keyframes komi-pack-tension {
  0%,100% { transform: none; }
  25% { transform: translateX(-1px) rotate(-2deg); }
  45% { transform: translateX(3px) rotate(3deg); }
  59% { transform: translateX(-4px) rotate(-5deg); }
  75% { transform: translateX(6px) rotate(5deg); }
}
@keyframes komi-pack-glow {
  0% { opacity: 0; transform: scale(.64); }
  34% { opacity: .48; }
  48% { opacity: .85; }
  100% { opacity: 0; transform: scale(1.18); }
}
.sv3-packs-entry {
  display: inline-flex; gap: 7px; align-items: center; justify-content: center;
  padding: 8px 11px; min-height: 42px; border: 1px solid #9147FF70; border-radius: 9px;
  color: #ecddff; background: #241738; font-size: 13px; text-decoration: none;
}
.sv3-packs-entry:hover { border-color: #9147FF; }

/* Keep one accessible number at a stable digit width; only visually tween it. */
:is(#komiHeaderAniCoinValue,[data-shop-wallet],[data-pack-wallet],.anicoin-wallet-number,#premium-store-value) {
  display:inline-block;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

/* A motion preference changed while a balance animation was in progress. */
@media (prefers-reduced-motion:reduce) {
  :is(#komiHeaderAniCoinValue,[data-shop-wallet],[data-pack-wallet],.anicoin-wallet-number,#premium-store-value) {
    transform:none!important;
    opacity:1!important;
  }
}

/* Premium comparison and FAQ */
:is(.komi-premium-comparison,#premium-offer) {
  position: relative; isolation: isolate; overflow: hidden; border: 1px solid #9147FF63 !important;
  background: rgb(17 17 24 / .78) !important; backdrop-filter: blur(12px);
}
:is(.komi-premium-comparison,#premium-offer)::before {
  content: ""; position: absolute; z-index: -1; inset: -110%; pointer-events: none;
  background: conic-gradient(from 90deg,transparent 0 19%,#9147FF 27%,transparent 43% 59%,#FF454F 69%,transparent 84%);
  animation: komi-collector-orbit 13s linear infinite;
}
:is(.komi-premium-comparison,#premium-offer)::after {
  content: ""; position: absolute; z-index: -1; inset: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(142deg,rgb(30 21 46 / .98),#111118 55%);
}
.komi-premium-matrix { width: 100%; border-collapse: collapse; text-align: start; font-size: clamp(11px,2.9vw,15px); table-layout: fixed; }
.komi-premium-matrix :is(th,td) {
  padding: clamp(7px,1.4vw,12px) clamp(5px,1.4vw,12px);
  border-bottom: 1px solid rgb(255 255 255 / .10); text-align: left; overflow-wrap: anywhere;
}
.komi-premium-matrix thead th:first-child { width: 37%; }
.komi-premium-matrix thead th { color: #efdcff; }
.komi-premium-matrix :is(th,td):last-child { background: rgb(145 71 255 / .12); color: #f2e4ff; }
.komi-premium-faq { margin-top: clamp(18px,3vw,30px); }
.komi-premium-faq summary { cursor: pointer; min-height: 42px; padding: 8px 10px; font-weight: 650; }
.komi-premium-faq summary:focus-visible { outline: 2px solid #9147FF; outline-offset: 2px; }
.komi-premium-faq details { border-bottom: 1px solid rgb(255 255 255 / .12); }
.komi-premium-faq details > div { padding: 0 10px 12px; color: #d6cfe1; }
@supports (interpolate-size: allow-keywords) and selector(details::details-content) {
  .komi-premium-faq details { interpolate-size: allow-keywords; }
  .komi-premium-faq details::details-content {
    block-size: 0; opacity: 0; overflow: clip;
    transition: block-size .34s var(--collector-ease),opacity .23s var(--collector-ease),content-visibility .34s allow-discrete;
  }
  .komi-premium-faq details[open]::details-content { block-size: auto; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #profile.komi-profile-studio [data-profile-hero] .profile-cover > img { transform: none; transition: none; }
  #profile.komi-profile-studio [data-profile-hero]:has(.komi-premium-badge) .komi-profile-avatar-halo::before,
  #profile .profile-insight-track i, #komiFriendsDrawer .komi-drawer-online::after,
  #komiFriendsDrawer :is(.komi-drawer-live-title,.komi-friend-room-live)::after,
  .komi-pack-stage[data-phase="seal"] .kc-foil-object,
  :is(.komi-premium-comparison,#premium-offer)::before { animation: none; transition: none; }
  .komi-pack-stage .kc-real-pick:is(.is-revealing,.is-dealing) :is(.kc-foil-table,.kc-pick-burst)::after { animation: none; }
  .komi-premium-faq details::details-content { transition: none; }
}
