/* Emotes: the wheel (js/emotewheel.js), the phone's smiley button, the emote pictures and the cards the
   Loadout's Emotes tab and the Shop's shelf show them on (js/ui/emotes.js). */

/* ---------------------------------------------------------------- pictures */

.ea { display: inline-grid; place-items: center; width: 48px; height: 48px; color: var(--ink); }
.ea svg { width: 100%; height: 100%; overflow: visible; }
.ea .ea-fx { stroke: var(--ea-fx, var(--orange)); }
.ea .ea-dot { fill: var(--ea-fx, var(--orange)); stroke: none; }

/* ---------------------------------------------------------------- the wheel */

#emote-wheel {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(18, 32, 58, 0.32), rgba(18, 32, 58, 0) 62%);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  animation: ew-fade 0.14s ease-out both;
}
#emote-wheel[hidden] { display: none; }
.ew-ring {
  --r: 112px;
  --slot: 104px;
  position: relative;
  width: calc(2 * var(--r) + var(--slot));
  height: calc(2 * var(--r) + var(--slot));
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 32, 58, 0.62) 0 40%, rgba(18, 32, 58, 0.5) 41% 64%, rgba(18, 32, 58, 0) 65%);
  animation: ew-pop 0.24s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
/* A ring drawn round the middle, through the four slots. */
.ew-ring::before {
  content: "";
  position: absolute;
  inset: calc(var(--slot) / 2);
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.35);
}
.ew-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  width: var(--slot);
  height: var(--slot);
  margin: calc(var(--slot) / -2) 0 0 calc(var(--slot) / -2);
  padding: 6px 4px 8px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #ffffff, #e8eff9 70%);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 3px var(--rc, #dfe7f2), 0 5px 0 rgba(18, 32, 58, 0.45);
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.ew-slot[data-rarity="prime"] { --rc: var(--yellow); }
.ew-slot[data-rarity="galaxy"] { --rc: var(--purple); }
.ew-up { transform: translate(0, calc(-1 * var(--r))); }
.ew-right { transform: translate(var(--r), 0); }
.ew-down { transform: translate(0, var(--r)); }
.ew-left { transform: translate(calc(-1 * var(--r)), 0); }
.ew-slot.is-on { background: radial-gradient(circle at 50% 35%, #fff6c9, var(--yellow) 75%); box-shadow: inset 0 0 0 3px #fff, 0 0 0 5px rgba(255, 204, 46, 0.45), 0 6px 0 var(--yellow-dark); }
.ew-up.is-on { transform: translate(0, calc(-1 * var(--r) - 8px)) scale(1.12); }
.ew-right.is-on { transform: translate(calc(var(--r) + 8px), 0) scale(1.12); }
.ew-down.is-on { transform: translate(0, calc(var(--r) + 8px)) scale(1.12); }
.ew-left.is-on { transform: translate(calc(-1 * var(--r) - 8px), 0) scale(1.12); }
.ew-art { width: 52px; height: 52px; }
.ew-slot.is-on .ew-art { --ea-fx: #ff5a1f; animation: ew-bop 0.5s ease-in-out infinite alternate; }
/* Two short lines at most ("Victory Jump" fits). */
.ew-label { display: -webkit-box; max-width: 86%; overflow: hidden; font-size: 11px; font-weight: 900; line-height: 1.05; letter-spacing: 0.01em; text-align: center; text-transform: uppercase; overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ew-key { position: absolute; top: -4px; right: -2px; min-width: 20px; font-size: 11px; box-shadow: 0 0 0 2px var(--ink); }
.ew-plus { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 3px dashed #9fb0c8; color: #9fb0c8; font-family: var(--display); font-size: 26px; line-height: 1; }
.ew-slot.is-empty { background: rgba(242, 246, 252, 0.88); box-shadow: inset 0 0 0 3px #c9d6e6, 0 5px 0 rgba(18, 32, 58, 0.35); }
.ew-slot.is-empty .ew-label { color: var(--muted); }
.ew-mid {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  width: 128px;
  height: 128px;
  margin: -64px 0 0 -64px;
  border-radius: 50%;
  color: #fff;
  text-align: center;
  pointer-events: none;
}
.ew-name { max-width: 120px; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.05; text-shadow: 0 2px 0 rgba(18, 32, 58, 0.7); overflow-wrap: anywhere; }
.ew-hint { max-width: 112px; font-size: 11px; font-weight: 800; line-height: 1.2; color: #cfe0f7; }
.ew-edit {
  margin-top: 4px;
  padding: 3px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(18, 32, 58, 0.5);
  pointer-events: auto;
  cursor: pointer;
}
.ew-edit[hidden] { display: none; }
/* The locked mouse's pointer: where a flick has got to. */
.ew-dot { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(18, 32, 58, 0.55), 0 0 10px rgba(255, 255, 255, 0.8); pointer-events: none; }
.ew-dot[hidden] { display: none; }

@keyframes ew-fade { from { opacity: 0; } }
@keyframes ew-pop { from { transform: scale(0.72) rotate(-8deg); opacity: 0; } }
@keyframes ew-bop { to { transform: translateY(-3px) rotate(-4deg); } }

/* Phones: a smaller ring. */
@media (max-width: 560px), (max-height: 520px) {
  .ew-ring { --r: 94px; --slot: 88px; }
  .ew-art { width: 42px; height: 42px; }
  .ew-label { font-size: 10.5px; }
  .ew-mid { width: 104px; height: 104px; margin: -52px 0 0 -52px; }
  .ew-name { font-size: 17px; max-width: 100px; }
  .ew-hint { max-width: 96px; font-size: 10px; }
}

/* While the wheel is up, the lobby's buttons and the phone's controls step back. */
body.emoting #lobby-hud, body.emoting .touch-cluster, body.emoting #stick { opacity: 0.35; transition: opacity 0.12s ease; }

/* ---------------------------------------------------------------- the phone's button */

#touch-emote {
  position: absolute;
  right: calc(16px + 70px + 14px + env(safe-area-inset-right));
  bottom: calc(206px + 6px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  background: radial-gradient(circle at 50% 30%, #ffe27a, var(--yellow) 70%);
  color: var(--ink);
  box-shadow: inset 0 0 0 2.5px #fff, 0 4px 0 var(--yellow-dark);
}
#touch-emote::before { content: none; }
#touch-emote svg { width: 30px; height: 30px; }
#touch-emote[hidden] { display: none; }
#touch #touch-emote.held { background: #fff; box-shadow: inset 0 0 0 2.5px var(--yellow), 0 0 0 5px rgba(255, 204, 46, 0.4); }
/* The Slide or flying Down button takes the spot beside Jump: the smiley moves up over it. */
body.can-slide #touch-emote, body.flying #touch-emote { bottom: calc(206px + 84px + env(safe-area-inset-bottom)); }
/* On the Soccer Field (no Reload there) it takes Reload's place, between Use and Chip. */
body.soccer #touch-emote { right: calc(16px + 96px + 10px + 3px + env(safe-area-inset-right)); bottom: calc(18px + 98px + 10px + env(safe-area-inset-bottom)); }
@media (max-height: 520px) {
  #touch-emote { width: 52px; height: 52px; bottom: calc(132px + 4px + env(safe-area-inset-bottom)); right: calc(16px + 60px + 12px + env(safe-area-inset-right)); }
  #touch-emote svg { width: 26px; height: 26px; }
  body.can-slide #touch-emote, body.flying #touch-emote { bottom: calc(132px + 70px + env(safe-area-inset-bottom)); }
  body.soccer #touch-emote { right: calc(16px + 82px + 8px + 2px + env(safe-area-inset-right)); bottom: calc(18px + 82px + 8px + env(safe-area-inset-bottom)); }
}
@media (max-width: 400px) and (min-height: 501px) {
  #touch-emote { bottom: calc(272px + 6px + env(safe-area-inset-bottom)); }
  body.can-slide #touch-emote, body.flying #touch-emote { bottom: calc(272px + 84px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- cards (Loadout, Shop) */

.em-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px 9px; }
.em-card {
  --rc: #dfe7f2;
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-width: 0;
  min-height: 98px;
  padding: 8px 5px 8px;
  border: 0;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 30%, #ffffff, #eef3fa 75%);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 2px var(--rc), 0 4px 0 #d3dceb;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.em-card.r-prime { --rc: var(--yellow); background: radial-gradient(circle at 50% 30%, #fffdf2, #fff1c2 80%); box-shadow: inset 0 0 0 2px var(--rc), 0 4px 0 var(--yellow-dark); }
.em-card.r-galaxy { --rc: var(--purple); --ea-fx: #c026d3; background: radial-gradient(circle at 50% 30%, #fbf6ff, #e7d4ff 80%); box-shadow: inset 0 0 0 2px var(--rc), 0 4px 0 var(--purple-dark); }
@media (hover: hover) { .em-card:hover { transform: translateY(-2px); } }
.em-card:active { transform: translateY(2px); }
.em-card.is-sel { box-shadow: inset 0 0 0 3px var(--blue), 0 0 0 3px rgba(47, 125, 255, 0.35), 0 4px 0 var(--blue-dark); }
.em-card-art { display: grid; place-items: center; width: 100%; height: 52px; }
.em-card-art .ea { width: 52px; height: 52px; }
.em-card-name { max-width: 100%; font-size: 11.5px; font-weight: 900; line-height: 1.15; letter-spacing: 0.01em; text-align: center; text-transform: uppercase; overflow-wrap: anywhere; }
.em-card-slot { position: absolute; top: -7px; right: -6px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 900; box-shadow: 0 0 0 2px #fff; }
.em-card-price { margin-top: 2px; font-size: 12px; }
.em-card-price .cur { padding: 1px 7px 1px 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); box-shadow: inset 0 0 0 1.5px rgba(18, 32, 58, 0.12); }
.em-card.is-locked .em-card-art { opacity: 0.6; filter: saturate(0.5); }

/* ---------------------------------------------------------------- Loadout: the Emotes tab */

.lo-tabs.has-emotes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lo-tab-emotes .lo-tab-art.ea { width: 40px; height: 40px; }
.lo-tab-emotes.is-on { background: var(--orange); box-shadow: inset 0 -4px 0 var(--orange-dark), 0 4px 0 #b45300; }
.lo-tab-emotes.is-on .lo-tab-slot { color: #ffe2c4; }
.lo-tab-emotes.is-on .ea { color: #fff; --ea-fx: var(--yellow); }
.em-pv { --pv-top: #ffe6c9; --pv-bottom: #ffb066; --glow: rgba(255, 249, 240, 0.95); }
.em-pv[data-tier="prime"] { --pv-top: #fff3cc; --pv-bottom: #ffc94a; }
.em-pv[data-tier="galaxy"] { --pv-top: #eadcff; --pv-bottom: #9d6bf2; }
/* No canvas (the preview failed): the emote's picture instead. */
.em-pv .pv-art { inset: 12% 22% 12%; }
.em-pv .pv-art .ea { width: 100%; height: 100%; }
.em-wheel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: ". up ." "left mid right" ". down .";
  gap: 6px;
  max-width: 330px;
  margin: 4px auto 0;
}
.em-slot {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  min-height: 82px;
  padding: 6px 4px;
  border: 0;
  border-radius: 16px;
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 2px #dfe7f2, 0 3px 0 #d3dceb;
  cursor: pointer;
}
.em-slot .ea { width: 40px; height: 40px; }
.em-slot-dir { font-size: 10px; font-weight: 900; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.em-slot-name { max-width: 100%; overflow: hidden; font-size: 11px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.em-slot.is-this { background: #e8f1ff; box-shadow: inset 0 0 0 3px var(--blue), 0 3px 0 var(--blue-dark); }
.em-slot:disabled { cursor: default; opacity: 0.7; }
@media (hover: hover) { .em-slot:not(:disabled):hover { transform: translateY(-2px); } }
.em-slot.is-empty .ea { opacity: 0.25; }
.em-mid { grid-area: mid; display: grid; place-items: center; border-radius: 50%; color: var(--orange); }
.em-mid .m-ico { width: 40px; height: 40px; }
.em-keys { margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.em-keys kbd { font-size: 11px; }

/* ---------------------------------------------------------------- Shop: the emotes shelf */

.em-shop { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.em-shop-hero { position: sticky; top: 64px; display: grid; gap: 10px; }
.em-shop .em-pv { aspect-ratio: 5 / 4; max-height: 46vh; }
.em-shop-info { display: grid; gap: 6px; }
.em-shop-name { margin: 0; font-size: 30px; }
.em-shop-blurb { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.35; color: var(--ink-2); }
.em-shop-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.em-shop-buy .btn .cur { padding: 2px 8px 2px 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); }
.em-shop-group + .em-shop-group { margin-top: 16px; }
.em-shop-t { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 19px; }
@media (max-width: 760px), (max-height: 520px) {
  .em-shop { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .em-shop-hero { position: static; grid-template-columns: 140px minmax(0, 1fr); align-items: center; }
  .em-shop .em-pv { aspect-ratio: 3 / 4; }
  .em-shop-name { font-size: 23px; }
  .em-shop-blurb { font-size: 13px; }
  .em-cards { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 9px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #emote-wheel, .ew-ring, .ew-slot.is-on .ew-art { animation: none; }
}
