* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #05060d; overflow: hidden;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #e8eef5; user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
#stage {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  --u: 1px;
}
#c { display: block; touch-action: none; }
.hidden { display: none !important; }

#hudbtns { position: absolute; right: calc(var(--u) * 12); top: calc(var(--u) * 8); display: flex; gap: calc(var(--u) * 6); }
#hudbtns button {
  width: calc(var(--u) * 40); height: calc(var(--u) * 34); border-radius: calc(var(--u) * 9);
  border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: #e8eef5;
  font-size: calc(var(--u) * 15); font-weight: 800; padding: 0; cursor: pointer;
}

#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 4, 10, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  font-size: calc(var(--u) * 16); padding: calc(var(--u) * 18);
  animation: fadein 0.18s ease-out;
}
#overlay.clear { background: rgba(3, 4, 10, 0.35); backdrop-filter: none; -webkit-backdrop-filter: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes popin { from { transform: scale(0.9) translateY(calc(var(--u) * 12)); opacity: 0; } to { transform: none; opacity: 1; } }

.panel { width: 100%; max-height: 100%; overflow-y: auto; text-align: center; touch-action: pan-y; }
.panel h1 {
  font-size: 3.1em; margin: 0.1em 0 0; font-weight: 900; letter-spacing: 0.04em; line-height: 1;
  background: linear-gradient(90deg, #7dffb0, #3cf0ff, #ff7ae0); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 calc(var(--u) * 12) rgba(60, 240, 255, 0.35));
}
.panel h2 { font-size: 2em; margin: 0 0 0.2em; font-weight: 900; color: #ffd166; text-shadow: 0 0 calc(var(--u) * 14) rgba(255, 209, 102, 0.5); }
.panel .sub { color: #9fb4c8; margin: 0 0 1em; font-size: 0.95em; }
.panel .kana { color: #9fb4c8; font-weight: 700; letter-spacing: 0.3em; margin: 0.4em 0 1.4em; }

.btn {
  display: block; width: 100%; margin: 0.55em 0; padding: 0.8em 1em; border-radius: 0.8em;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.07); color: #e8eef5;
  font: inherit; font-size: 1.1em; font-weight: 800; cursor: pointer;
}
.btn.primary { background: linear-gradient(135deg, #18c98a, #0ea5c6); border-color: transparent; color: #04140f; font-size: 1.3em; box-shadow: 0 0 calc(var(--u) * 22) rgba(24, 201, 138, 0.35); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.4; }
.row { display: flex; gap: 0.6em; }
.row .btn { flex: 1; }

.cards { display: flex; flex-direction: column; gap: 0.6em; margin: 0.4em 0 0.8em; }
.card {
  display: grid; grid-template-columns: 3em 1fr; grid-template-rows: auto auto; column-gap: 0.7em; align-items: center;
  text-align: left; padding: 0.8em 0.9em; border-radius: 0.9em; cursor: pointer; font: inherit; color: #e8eef5;
  background: rgba(20, 26, 44, 0.95); border: 2px solid var(--rc, #9fb4c8);
  box-shadow: 0 0 calc(var(--u) * 16) color-mix(in srgb, var(--rc, #9fb4c8) 35%, transparent);
  animation: popin 0.25s ease-out both;
}
.card:nth-child(2) { animation-delay: 0.05s; } .card:nth-child(3) { animation-delay: 0.1s; } .card:nth-child(4) { animation-delay: 0.15s; }
.card:active { transform: scale(0.98); }
.card .icon { grid-row: 1 / 3; font-size: 2.1em; text-align: center; }
.card .cname { font-weight: 900; font-size: 1.15em; }
.card .cname small { font-weight: 700; font-size: 0.7em; color: #8b9bb0; margin-left: 0.5em; }
.card .desc { color: #b9c7d6; font-size: 0.88em; line-height: 1.4; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45em; margin: 0.8em 0 1em; }
.stat { background: rgba(255,255,255,0.05); border-radius: 0.7em; padding: 0.55em 0.4em; }
.stat .k { color: #6f8196; font-size: 0.75em; font-weight: 700; }
.stat .v { font-size: 1.25em; font-weight: 900; }
.stat.big { grid-column: 1 / 3; }
.stat.big .v { font-size: 2em; color: #fff; }
.new { color: #ff7ae0; font-size: 0.65em; font-weight: 900; margin-left: 0.4em; vertical-align: middle; }
.coins { color: #ffd166; font-weight: 900; }
.ups { display: flex; flex-wrap: wrap; gap: 0.3em; justify-content: center; margin: 0.4em 0 1em; }
.ups span { background: rgba(255,255,255,0.06); border-radius: 0.5em; padding: 0.2em 0.45em; font-size: 0.85em; }

.shop { display: flex; flex-direction: column; gap: 0.45em; margin: 0.8em 0 1em; }
.perk { display: grid; grid-template-columns: 2.2em 1fr auto; align-items: center; gap: 0.6em; text-align: left;
  background: rgba(255,255,255,0.05); border-radius: 0.8em; padding: 0.6em 0.8em; }
.perk .icon { font-size: 1.5em; text-align: center; }
.perk .pname { font-weight: 800; }
.perk .plv { color: #6f8196; font-size: 0.8em; }
.perk button { font: inherit; font-weight: 900; padding: 0.5em 0.8em; border-radius: 0.6em; border: none; background: #ffd166; color: #221a00; cursor: pointer; min-width: 5em; }
.perk button[disabled] { background: rgba(255,255,255,0.12); color: #6f8196; }

.howto { text-align: left; line-height: 1.6; font-size: 0.92em; color: #c9d5e2; }
.howto b { color: #7dffb0; }
.howto ul { padding-left: 1.2em; margin: 0.3em 0 0.9em; }
.best { color: #9fb4c8; font-size: 0.9em; margin: 0 0 1.2em; line-height: 1.7; }
.best b { color: #e8eef5; }
.btn small { display: block; font-size: 0.62em; font-weight: 700; opacity: 0.75; margin-top: 0.15em; }
.btn.endless { background: linear-gradient(135deg, #7b2cbf, #ff4d9d); border-color: transparent; color: #fff; font-size: 1.15em; box-shadow: 0 0 calc(var(--u) * 18) rgba(255, 77, 157, 0.3); }
.card.evo { background: linear-gradient(135deg, rgba(60, 44, 10, 0.97), rgba(40, 20, 50, 0.97)); box-shadow: 0 0 calc(var(--u) * 26) rgba(255, 209, 102, 0.55); }
.card .hint { grid-column: 2; color: #ffd166; font-size: 0.75em; margin-top: 0.25em; opacity: 0.85; }
.panel h2.clear { font-size: 2.4em; background: linear-gradient(90deg, #ffd166, #ff7ae0, #7df9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mode-best { margin: 0.2em 0; }
.mode-best span { display: inline-block; font-size: 0.75em; font-weight: 800; padding: 0.05em 0.5em; border-radius: 0.4em; background: rgba(255,255,255,0.1); margin-right: 0.3em; }
.evos { font-size: 0.85em; line-height: 1.7; margin: 0.2em 0 1em; }
.evos b { color: #ffd166; }
/* Rarity is only hinted by the frame: grey < blue < pink glow < gold shimmer. */
.card[data-r="C"] { border-width: 1.5px; box-shadow: none; }
.card[data-r="E"] { border-width: 2.5px; box-shadow: 0 0 calc(var(--u) * 24) color-mix(in srgb, var(--rc) 55%, transparent); }
.card[data-r="X"] { border-width: 3px; animation: popin 0.25s ease-out both, shimmer 1.6s ease-in-out infinite; }
@keyframes shimmer {
  0%, 100% { box-shadow: 0 0 calc(var(--u) * 18) rgba(255, 209, 102, 0.45); }
  50% { box-shadow: 0 0 calc(var(--u) * 34) rgba(255, 209, 102, 0.85); }
}

/* Share, ranking registration and the ranking list. */
a.btn { text-decoration: none; box-sizing: border-box; }
.btn.share { background: #000; border-color: rgba(255,255,255,0.35); color: #fff; }
.btn.share .xlogo { width: 1em; height: 1em; vertical-align: -0.12em; margin-right: 0.2em; }
.btn.save { font-size: 0.85em; padding-top: 0.45em; padding-bottom: 0.45em; opacity: 0.85; }
.btn.share.hot { font-size: 1.2em; border-color: #ff7ae0; box-shadow: 0 0 calc(var(--u) * 18) rgba(255, 122, 224, 0.35); }
.rk { color: #9fb4c8; font-size: 0.9em; margin: 0 0 0.6em; }
.rk.in { color: #ffd166; font-weight: 800; }
.rk b { font-size: 1.15em; }
.rkform { display: flex; gap: 0.5em; align-items: stretch; }
.rkform input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.05em; font-weight: 700; padding: 0.55em 0.7em; margin: 0.55em 0;
  border-radius: 0.7em; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #fff;
  user-select: text; -webkit-user-select: text;
}
.rkform .btn { width: auto; flex: none; font-size: 1.05em; padding: 0.55em 1.1em; }
.rkerr { color: #ff7a7a; font-size: 0.85em; min-height: 1.2em; }
.ranking { display: flex; flex-direction: column; gap: 0.25em; margin: 0.4em 0 1em; text-align: left; }
.rrow { display: grid; grid-template-columns: 2em 1fr auto 3.2em; gap: 0.5em; align-items: baseline;
  background: rgba(255,255,255,0.05); border-radius: 0.6em; padding: 0.4em 0.6em; font-size: 0.92em; }
.rrow:nth-child(-n+3) .rno { color: #ffd166; }
.rrow.me { background: rgba(24, 201, 138, 0.18); outline: 1px solid rgba(24, 201, 138, 0.6); }
.rno { font-weight: 900; text-align: right; color: #9fb4c8; }
.rname { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rscore { font-weight: 900; font-variant-numeric: tabular-nums; }
.rmeta { color: #6f8196; font-size: 0.8em; text-align: right; }
