html {
  -ms-touch-action: none;
  background-color: #1a4a9e;
  color-scheme: light;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  /* display: none; <- Crashes Chrome on hover */
  -webkit-appearance: none;
  margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;

  cursor: default;
  color: #888;
  background-color: #1a4a9e;

  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;

  display: flex;
  flex-direction: column;
  
  /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
  /* overflow cannot be applied in Cocos2dGameContainer, 
  otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
  overflow: hidden;
}

#Cocos2dGameContainer {
  position: absolute;
  margin: 0;
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;

  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: center;
}

canvas {
  background-color: transparent;
}

/* Avoid default 300×150 black canvas flash before Cocos boots */
#GameCanvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  background-color: #1a4a9e;
}

a:link, a:visited {
  color: #666;
}

a:active, a:hover {
  color: #666;
}

p.header {
  font-size: small;
}

p.footer {
  font-size: x-small;
}

@font-face {
  font-family: "Use Font";
  src: url("font/Use%20Font.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

#rank-root {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  font-family: "Use Font", "Trebuchet MS", Helvetica, Arial, sans-serif;
}

.rank-hidden { display: none !important; }

#rank-lobby {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(61, 126, 245, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(18, 196, 168, 0.12) 0%, transparent 50%),
    rgba(4, 14, 40, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

#rank-result {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(61, 126, 245, 0.35) 0%, transparent 55%),
    #0a1640;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

#rank-nospace {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 14, 40, 0.28);
}

#rank-nospace span {
  font-family: "Use Font", "Trebuchet MS", Helvetica, Arial, sans-serif;
  font-size: clamp(34px, 10vw, 52px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 1px;
  color: #fff;
  text-align: center;
  text-shadow:
    0 3px 0 #9a0000,
    0 6px 0 #5a0000,
    0 10px 22px rgba(0, 0, 0, 0.55);
  transform: scale(0.7);
  opacity: 0;
}

#rank-nospace.rank-nospace-on span {
  animation: rank-nospace-pop 1.45s cubic-bezier(0.18, 1.2, 0.32, 1) forwards;
}

@keyframes rank-nospace-pop {
  0% { opacity: 0; transform: scale(0.55) rotate(-4deg); }
  18% { opacity: 1; transform: scale(1.12) rotate(-2deg); }
  55% { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.05) translateY(-10px); }
}

.rank-card {
  position: relative;
  overflow: hidden;
  width: min(88vw, 360px);
  background: linear-gradient(165deg, #4a88f7 0%, #2a6ad6 38%, #1a4a9e 72%, #123070 100%);
  color: #fff;
  border-radius: 26px;
  padding: 28px 22px 18px;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  border: none;
  box-sizing: border-box;
  animation: rank-card-in 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.rank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, transparent 42%);
  pointer-events: none;
}

.rank-card::after {
  content: "";
  position: absolute;
  top: -55%;
  left: -15%;
  width: 130%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.1) 0%, transparent 68%);
  pointer-events: none;
}

.rank-card > * {
  position: relative;
  z-index: 1;
}

@keyframes rank-card-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.rank-title {
  position: relative;
  z-index: 1;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-align: center;
  margin: 0 0 4px;
  text-shadow: 0 3px 14px rgba(0, 28, 72, 0.45);
  background: linear-gradient(180deg, #ffffff 20%, #d4e4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rank-title::before {
  display: block;
  font-size: 26px;
  line-height: 1;
  margin-bottom: 6px;
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

/* #rank-lobby .rank-title::before {
  content: "⚔";
}

#rank-result .rank-title::before {
  content: "🏆";
} */

.rank-sub,
#rank-status {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.4;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#rank-status.rank-status-error {
  color: #ff6b6b;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(255, 80, 80, 0.35);
}

#rank-result-body {
  position: relative;
  z-index: 1;
  font-size: 19px;
  color: #fff;
  margin: 8px 0 18px;
  line-height: 1.55;
  font-weight: 700;
  white-space: pre-line;
  text-align: center;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#rank-result .rank-title {
  margin-bottom: 10px;
  font-size: clamp(28px, 8vw, 36px);
  letter-spacing: 1px;
}

.rank-result-banner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 12px;
  min-height: 48px;
}

.rank-result-banner img {
  display: block;
  width: min(78%, 260px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 20, 60, 0.45));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#rank-result .rank-result-banner.rank-result-win img {
  width: min(63%, 240px);
}

.rank-result-ratio {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  text-align: center;
  font-size: clamp(34px, 10vw, 46px);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  margin: 4px 0 16px;
  color: #fff;
  text-shadow: 0 3px 12px rgba(0, 20, 60, 0.45);
}

.rank-result-ratio-me {
  color: #ffd24a;
  text-shadow:
    0 2px 0 rgba(120, 60, 0, 0.35),
    0 3px 12px rgba(255, 180, 40, 0.45);
}

.rank-result-ratio-vs {
  font-size: 0.55em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.78);
  align-self: center;
}

.rank-result-ratio-opp {
  color: #fff;
}

.rank-result-scores {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rank-result-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rank-result-score-label {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.3px;
}

.rank-result-score-num {
  font-size: clamp(22px, 6.5vw, 28px);
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.rank-result-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
}

.rank-result-actions .rank-btn {
  flex: 1;
  width: auto;
  min-width: 0;
}

.rank-btn-leave,
#rank-btn-leave {
  background: linear-gradient(180deg, #6b84b8 0%, #3f5688 55%, #2a3d68 100%);
  text-shadow: 0 1px 0 rgba(0, 20, 50, 0.3);
}

#rank-result #rank-status,
#rank-result .rank-sub {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

#rank-home,
#rank-waiting {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-card > .rank-card-x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28);
  -webkit-appearance: none;
  appearance: none;
}

.rank-card > .rank-card-x:active {
  transform: scale(0.92);
  background: rgba(0, 0, 0, 0.42);
}

.rank-btn,
#rank-home button,
#rank-waiting button,
#rank-result button {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 16px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.4px;
  font-family: inherit;
  color: #fff;
  margin: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.rank-btn:active,
#rank-home button:active,
#rank-waiting button:active,
#rank-result button:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(0.96);
}

.rank-btn-primary,
#rank-btn-create,
#rank-btn-copy,
#rank-btn-again,
#rank-btn-close {
  background: linear-gradient(180deg, #ffc04a 0%, #ff8f1a 55%, #f06800 100%);
  text-shadow: 0 1px 0 rgba(120, 40, 0, 0.25);
}

.rank-btn-teal,
#rank-btn-join {
  background: linear-gradient(180deg, #5aebd4 0%, #1fd4b6 55%, #0fa892 100%);
  text-shadow: 0 1px 0 rgba(0, 80, 65, 0.22);
}

.rank-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 2px 0;
}

.rank-or::before,
.rank-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

#rank-join-code {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 16px;
  padding: 15px 12px;
  font-size: 18px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-align: center;
  color: #123070;
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  box-shadow:
    inset 0 2px 6px rgba(18, 48, 112, 0.08),
    0 0 0 2px rgba(255, 255, 255, 0.55);
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

#rank-join-code:focus {
  outline: none;
  box-shadow:
    inset 0 2px 6px rgba(18, 48, 112, 0.08),
    0 0 0 3px rgba(255, 192, 74, 0.85);
  transform: scale(1.01);
}

#rank-join-code.rank-input-error {
  box-shadow:
    inset 0 2px 6px rgba(120, 20, 20, 0.08),
    0 0 0 3px rgba(255, 90, 90, 0.95);
  animation: rank-input-shake 0.35s ease;
}

#rank-join-code.rank-input-error:focus {
  box-shadow:
    inset 0 2px 6px rgba(120, 20, 20, 0.08),
    0 0 0 3px rgba(255, 90, 90, 0.95);
}

@keyframes rank-input-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

#rank-join-code::placeholder {
  letter-spacing: 3px;
  font-size: 15px;
  color: #9aafd4;
  font-weight: 700;
}

.rank-code-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 800;
}

#rank-code-value {
  font-size: 26px;
  letter-spacing: 10px;
  font-weight: 800;
  margin: 0;
  padding: 12px 10px;
  text-align: center;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  color: #fff;
}

#rank-count {
  pointer-events: none;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: 96px;
  font-weight: 700;
  font-style: italic;
  color: #fff;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

#rank-count .rank-count-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  line-height: 1;
  text-align: center;
  font-style: italic;
}

#rank-opp {
  --opp-w: 112px;
  pointer-events: none;
  position: fixed;
  left: max(8px, env(safe-area-inset-left, 0px));
  top: max(8px, env(safe-area-inset-top, 0px));
  width: min(clamp(72px, 18vw, 96px), 18vh);
  aspect-ratio: auto;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  background: #12245a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.55);
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

@media (min-width: 480px) {
  #rank-opp {
    width: min(clamp(80px, 14vw, 112px), 20vh);
  }
}

@media (min-width: 768px) {
  #rank-opp {
    width: min(clamp(112px, 12vw, 140px), 22vh);
  }
}

@media (min-width: 1024px) {
  #rank-opp {
    left: 16px;
    top: 16px;
    width: 124px;
    border-radius: 10px;
    border-width: 2px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  }

  #rank-opp-points {
    font-size: 11px;
  }

  #rank-opp-score {
    font-size: 12px;
  }
}

@media (max-width: 359px) {
  #rank-opp {
    width: min(clamp(68px, 22vw, 82px), 16vh);
  }
}

#rank-opp-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 1.5px;
  padding: 4px;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.rank-opp-cell {
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.rank-opp-cell.c1 { background: #3b82f6; }
.rank-opp-cell.c2 { background: #f5c518; }
.rank-opp-cell.c3 { background: #a855f7; }
.rank-opp-cell.c4 { background: #f59e0b; }
.rank-opp-cell.c5 { background: #22c55e; }
.rank-opp-cell.c6 { background: #ef4444; }
.rank-opp-cell.c7 { background: #06b6d4; }
.rank-opp-cell.c8 { background: #ec4899; }
.rank-opp-cell.c9 { background: #84cc16; }
.rank-opp-cell.c10,
.rank-opp-cell.ca { background: #6b7280; }

#rank-opp-hud,
#rank-opp-foot {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 26px;
  padding: 0 7px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.18));
}

#rank-opp-hud {
  justify-content: center;
}

#rank-opp-foot {
  justify-content: space-between;
  gap: 6px;
}

#rank-opp-points {
  color: #fff;
  font-size: clamp(10px, calc(var(--opp-w, 112px) * 0.11), 14px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#rank-opp-tray {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: auto;
  flex-shrink: 0;
}

#rank-opp-tray i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

#rank-opp-tray i.on {
  background: #ffc04a;
  box-shadow: 0 0 6px rgba(255, 192, 74, 0.55);
}

#rank-opp-score {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  background: none;
  color: #ffd36a;
  font-size: clamp(10px, calc(var(--opp-w, 112px) * 0.1), 13px);
  font-weight: 700;
  padding: 0;
  text-align: left;
  flex-shrink: 0;
  line-height: 1;
}

#rank-opp-board {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  background: #0c1638;
}

#rank-opp.rank-opp-sm {
  border-radius: 10px;
  border-width: 1.5px;
}

#rank-opp.rank-opp-sm #rank-opp-hud,
#rank-opp.rank-opp-sm #rank-opp-foot {
  height: 22px;
  padding: 0 5px;
}

#rank-opp.rank-opp-cocos {
  background: transparent;
  overflow: hidden;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

#rank-opp.rank-opp-cocos #rank-opp-hud,
#rank-opp.rank-opp-cocos #rank-opp-foot {
  background: rgba(12, 24, 64, 0.88);
  border: none;
  box-shadow: none;
  border-radius: 0;
}

#rank-opp.rank-opp-cocos #rank-opp-board {
  background: transparent;
  border: none;
  border-radius: 0;
}

#rank-opp.rank-opp-cocos #rank-opp-grid {
  display: none;
}

#rank-opp.rank-opp-danger,
#rank-opp.rank-opp-cocos.rank-opp-danger {
  border: 2px solid #ff2d2d;
  box-shadow: 0 0 0 1px rgba(255, 60, 60, 0.55), 0 0 18px rgba(255, 36, 36, 0.85);
  animation: rank-opp-pulse-red 0.7s ease-in-out infinite;
}

#rank-opp.rank-opp-combo,
#rank-opp.rank-opp-cocos.rank-opp-combo {
  border: 2px solid #ffd24a;
  box-shadow: 0 0 0 2px rgba(255, 224, 110, 0.95), 0 0 22px rgba(255, 210, 50, 1);
  animation: rank-opp-pulse-gold 0.55s ease-in-out infinite;
}

#rank-opp.rank-opp-incoming {
  animation: rank-opp-incoming 0.72s ease-out;
  z-index: 10045;
}

@keyframes rank-opp-incoming {
  0% {
    filter: brightness(1.85);
    transform: scale(1.12);
    box-shadow: 0 0 0 4px #fff, 0 0 0 8px #ff4d2e, 0 0 28px rgba(255, 80, 40, 1);
  }
  40% {
    filter: brightness(1.35);
    transform: scale(1.06);
    box-shadow: 0 0 0 3px #ffd24a, 0 0 24px rgba(255, 210, 70, 0.95);
  }
  100% {
    filter: brightness(1);
    transform: scale(1);
  }
}

@keyframes rank-opp-pulse-red {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 60, 60, 0.45), 0 0 10px rgba(255, 36, 36, 0.55); }
  50% { box-shadow: 0 0 0 2px rgba(255, 80, 80, 0.9), 0 0 22px rgba(255, 40, 40, 1); }
}

@keyframes rank-opp-pulse-gold {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 210, 74, 0.5), 0 0 10px rgba(255, 196, 40, 0.55); }
  50% { box-shadow: 0 0 0 2px rgba(255, 224, 110, 0.95), 0 0 22px rgba(255, 210, 50, 1); }
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: 400;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

#rank-net {
  pointer-events: none;
  position: fixed;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 7px 0 5px;
  border-radius: 8px;
  background: rgba(8, 20, 52, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

#rank-net #rank-net-icon {
  font-size: 14px;
  width: 18px;
  height: 18px;
}

#rank-net-ms {
  min-width: 2.4em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

#rank-net.rank-net-good {
  color: #7dffb0;
  border-color: rgba(125, 255, 176, 0.35);
}

#rank-net.rank-net-ok {
  color: #ffd24a;
  border-color: rgba(255, 210, 74, 0.4);
}

#rank-net.rank-net-bad {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.45);
}

#rank-fs {
  pointer-events: auto;
  position: fixed;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 10000;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 9px;
  border: 0;
  border-radius: 14px;
  background: rgba(12, 28, 72, 0.55);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  box-sizing: border-box;
}

#rank-fs svg {
  display: block;
  width: 100%;
  height: 100%;
}

#rank-install {
  pointer-events: auto;
  position: fixed;
  top: auto;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 52px);
  z-index: 10002;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin: 0;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffc04a 0%, #ff8f1a 55%, #f06800 100%);
  color: #fff;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

#rank-install.rank-hidden {
  display: none !important;
}

#rank-update {
  pointer-events: auto;
  position: fixed;
  top: auto;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 52px);
  z-index: 10002;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin: 0;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #4ad4ff 0%, #1a88f0 55%, #0a5ad0 100%);
  color: #fff;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

#rank-update.rank-hidden {
  display: none !important;
}

#rank-update:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.rank-update-ico {
  display: block;
  width: 16px;
  height: 16px;
}

#rank-install:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.rank-install-ico {
  font-size: 16px;
  line-height: 1;
}

#rank-install-tip {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: rgba(4, 14, 40, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
}

#rank-install-tip.rank-hidden {
  display: none !important;
}

.rank-install-sheet {
  position: relative;
  width: min(92vw, 360px);
  margin-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  padding: 22px 18px 18px;
  border-radius: 22px;
  background: linear-gradient(165deg, #4a88f7 0%, #1a4a9e 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.rank-install-sheet-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.rank-install-sheet-body {
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

#rank-install-tip .rank-card-x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
}

#rank-chat {
  pointer-events: none;
  position: fixed;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#rank-chat-toggle,
#rank-chat-panel,
#rank-chat-panel * {
  pointer-events: auto;
}

#rank-chat-toggle {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: rgba(12, 28, 72, 0.72);
  color: #fff;
  font-size: 22px;
  line-height: 44px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

#rank-chat-toggle.rank-chat-toggle-open {
  background: rgba(42, 106, 214, 0.88);
}

#rank-chat-panel {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 24, 62, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

#rank-chat-emojis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  max-height: min(38vh, 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.rank-chat-emoji-btn {
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: clamp(18px, 5vw, 22px);
  line-height: 1;
  cursor: pointer;
}

.rank-chat-emoji-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
}

.rank-chat-pic-btn {
  overflow: hidden;
  padding: 3px;
}

.rank-chat-pic-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#rank-chat-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

#rank-chat-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}

#rank-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

#rank-chat-send {
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #3d7ef0 0%, #2a6ad6 100%);
  color: #fff;
  font-size: 16px;
  line-height: 34px;
  cursor: pointer;
}

#rank-chat-toasts {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  overflow: visible;
}

.rank-chat-bubble {
  position: absolute;
  opacity: 0;
  transform: translateY(12px) scale(0.55);
  transition: opacity 0.45s ease, transform 2.1s ease;
  will-change: transform, opacity;
}

.rank-chat-bubble-emoji {
  font-size: clamp(36px, 10vw, 52px);
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.rank-chat-bubble-pic {
  width: clamp(72px, 22vw, 108px);
  height: clamp(72px, 22vw, 108px);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.rank-chat-bubble-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rank-chat-bubble-text {
  max-width: 72%;
  padding: 7px 12px;
  border-radius: 16px;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  word-break: break-word;
}

.rank-chat-bubble-mine.rank-chat-bubble-text {
  background: rgba(42, 106, 214, 0.92);
}

.rank-chat-bubble-opp.rank-chat-bubble-text {
  background: rgba(196, 72, 52, 0.92);
}

.rank-chat-bubble-show {
  opacity: 1;
  transform: translateY(-72px) scale(1);
}

.rank-chat-bubble-out {
  opacity: 0;
  transform: translateY(-96px) scale(0.92);
}

#rank-send-fx {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10040;
  overflow: visible;
}

.rank-send-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 50% 48%, rgba(255, 210, 70, 0.28) 0%, transparent 70%);
  animation: rank-send-flash 0.35s ease-out forwards;
}

@keyframes rank-send-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.rank-send-beam {
  position: fixed;
  height: 14px;
  margin-top: -7px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 80, 40, 0.15), #ffd24a 18%, #fff 52%, #ff4d2e 88%);
  box-shadow: 0 0 18px #ff6a3c, 0 0 32px rgba(255, 210, 70, 0.9);
  z-index: 10041;
}

.rank-send-shot {
  position: fixed;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f5c518;
  box-shadow: 0 0 16px rgba(255, 230, 90, 0.95), 0 3px 8px rgba(0, 0, 0, 0.5);
  z-index: 10042;
  will-change: transform, opacity;
}

.rank-send-tag,
.rank-send-burst {
  position: fixed;
  z-index: 10043;
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
  will-change: transform, opacity;
}

.rank-send-tag {
  font-size: clamp(28px, 8vw, 42px);
  text-shadow:
    0 3px 0 #9a0000,
    0 6px 0 #5a0000,
    0 8px 16px rgba(0, 0, 0, 0.55);
}

.rank-send-burst {
  font-size: clamp(26px, 7.5vw, 38px);
  text-shadow:
    0 3px 0 #9a0000,
    0 6px 14px rgba(0, 0, 0, 0.6);
}

#rank-hit-fx {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10050;
}

#rank-hit-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255, 48, 40, 0.55) 0%, rgba(180, 0, 20, 0.22) 55%, transparent 78%);
  opacity: 0;
}

#rank-hit-fx.rank-hit-fx-on #rank-hit-flash {
  animation: rank-hit-flash 0.32s ease-out;
}

#rank-hit-fx.rank-hit-fx-big #rank-hit-flash {
  background: radial-gradient(ellipse 80% 65% at 50% 42%, rgba(255, 30, 30, 0.72) 0%, rgba(140, 0, 10, 0.38) 52%, transparent 80%);
  animation: rank-hit-flash 0.46s ease-out;
}

#rank-hit-stamp {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.35) rotate(-10deg);
  font-family: "Use Font", Helvetica, Arial, sans-serif;
  font-size: clamp(72px, 22vw, 128px);
  font-weight: 900;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  text-shadow:
    0 5px 0 #9a0000,
    0 10px 0 #5a0000,
    0 16px 28px rgba(0, 0, 0, 0.55);
}

#rank-hit-fx.rank-hit-fx-on #rank-hit-stamp {
  animation: rank-hit-stamp 0.68s cubic-bezier(0.18, 1.35, 0.32, 1) forwards;
}

#rank-hit-fx.rank-hit-fx-big #rank-hit-stamp {
  font-size: clamp(78px, 24vw, 140px);
  animation-duration: 0.78s;
}

@keyframes rank-hit-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes rank-hit-stamp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.28) rotate(-14deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2) rotate(-6deg);
  }
  52% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-8deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -38%) scale(1.06) rotate(-8deg);
  }
}
