/* Dexlet — retro-arcade Telegram mini-app skin.
   Palette and type follow development/whos-that-telegramon/
   "colour pallette to follow (guide only).txt": deep space blue, sky cyan and
   lime accents, Press Start 2P for display, VT323 for body. This is a NEW house
   look — the older concepts still run the #04101d/#3fd9ff Courier scheme. */

:root {
  --page: #020617;
  --card: #0c1e3e;
  --surface: #172554;
  --border: #1e3a8a;

  --text: #f8fafc;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --lime: #a3e635;
  --red: #ef4444;
  --yellow: #facc15;
  --purple: #a44dff;

  --display: "Press Start 2P", ui-monospace, Consolas, monospace;
  --body: "VT323", ui-monospace, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#shell { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* CRT texture over everything, never eats input */
#scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 60; opacity: .35;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .38) 0 1px, transparent 1px 3px);
}

/* --------------------------------------------------------------------- HUD */

#hud {
  position: absolute; z-index: 20;
  top: calc(8px + env(safe-area-inset-top)); left: 10px; right: 10px;
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px;
}

.hudCell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 7px 6px 6px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(56, 189, 248, .22);
}
.hudCell small { display: block; font-family: var(--display); font-size: 6.5px; color: var(--muted); letter-spacing: .1em; }
.hudCell strong { display: block; font-family: var(--display); font-size: 11px; color: var(--text); margin-top: 5px; }
.hudScore strong { color: var(--cyan); font-size: 13px; }
#hudStreak.hot { color: var(--lime); }

/* signal bar */

#signalWrap {
  position: absolute; z-index: 20;
  top: calc(66px + env(safe-area-inset-top)); left: 10px; right: 10px;
  display: flex; align-items: center; gap: 8px;
}
#signalBar {
  flex: 1; height: 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); overflow: hidden;
}
#signalFill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  transform-origin: left center;
}
#signalFill.low { background: linear-gradient(90deg, var(--yellow), var(--red)); }
#signalLabel { font-family: var(--display); font-size: 6.5px; color: var(--muted); letter-spacing: .1em; }

/* -------------------------------------------------------------- title card */

#titleCard {
  position: absolute; z-index: 30; left: 0; right: 0;
  top: calc(96px + env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.tcSmall {
  font-family: var(--display); font-size: 10px; color: var(--cyan); letter-spacing: .18em;
  animation: slamIn .28s cubic-bezier(.2, 1.6, .5, 1) both;
}
.tcBig {
  font-family: var(--display); font-size: clamp(15px, 5.4vw, 22px); color: var(--text);
  letter-spacing: .04em; line-height: 1.15;
  text-shadow: 0 0 14px rgba(56, 189, 248, .75), 0 3px 0 #0b2a52;
  animation: slamIn .3s .07s cubic-bezier(.2, 1.6, .5, 1) both;
}
.tcBig b { color: var(--yellow); }

@keyframes slamIn {
  from { opacity: 0; transform: scale(1.7); filter: blur(3px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* ------------------------------------------------------------------- chips */

#chips {
  position: absolute; z-index: 25;
  left: 10px; right: 10px; bottom: calc(14px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
}

.chip {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-width: 5px;
  border-radius: .75rem;
  color: var(--text);
  font-family: var(--body);
  font-size: 1.5rem;
  line-height: 1.05;
  letter-spacing: .02em;
  padding: 13px 8px 11px;
  min-height: 58px;
  cursor: pointer;
  overflow: hidden;
  animation: chipIn .22s both;
}
.chip:nth-child(2) { animation-delay: .04s; }
.chip:nth-child(3) { animation-delay: .08s; }
.chip:nth-child(4) { animation-delay: .12s; }

.chip:active { transform: translateY(4px); border-bottom-width: 1px; }
.chip.right { background: #1d3b12; border-color: var(--lime); color: var(--lime); }
.chip.wrong { background: #3a1417; border-color: var(--red); color: var(--red); }
.chip.dim   { opacity: .35; }
.chip[disabled] { cursor: default; }

@keyframes chipIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- dex card */

#reveal {
  position: absolute; z-index: 35; inset: auto 10px calc(14px + env(safe-area-inset-bottom));
  animation: chipIn .25s both;
}

.dexCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 13px 14px 15px;
  box-shadow: inset 0 1px 0 rgba(56, 189, 248, .25), 0 0 30px rgba(2, 6, 23, .9);
}
.dexTop { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.dexVerdict { font-family: var(--display); font-size: 8px; letter-spacing: .12em; color: var(--lime); }
.dexVerdict.miss { color: var(--red); }
.dexCaught { font-family: var(--display); font-size: 6.5px; color: var(--cyan); letter-spacing: .08em; }

.dexCard strong {
  display: block; font-family: var(--display); font-size: clamp(13px, 4.6vw, 18px);
  color: var(--text); letter-spacing: .02em;
  text-shadow: 0 0 12px rgba(56, 189, 248, .5);
}
.dexMeta { display: flex; gap: 7px; margin: 9px 0 8px; flex-wrap: wrap; }
.dexType, .dexRarity {
  font-family: var(--display); font-size: 7px; letter-spacing: .08em;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 9px;
  background: var(--surface); color: var(--muted);
}
.dexRarity.Uncommon { color: var(--lime); border-color: #3f6212; }
.dexRarity.Rare { color: var(--cyan); border-color: #075985; }
.dexRarity.Mythic { color: var(--purple); border-color: #5b21b6; }

.dexCard p { font-size: 1.35rem; line-height: 1.2; color: var(--text); opacity: .92; }
.dexCard small { display: block; margin-top: 6px; font-size: 1.05rem; color: var(--muted); }
.dexPoints { margin-top: 9px; font-family: var(--display); font-size: 9px; color: var(--lime); letter-spacing: .06em; }
.dexPoints:empty { display: none; }

/* ---------------------------------------------------------------- overlays */

.overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(23, 37, 84, .82) 0%, rgba(2, 6, 23, .96) 70%);
  overflow-y: auto;
}

.panel {
  width: 100%; max-width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(56, 189, 248, .25);
}

.panel h1 {
  font-family: var(--display); font-size: clamp(20px, 7vw, 28px); letter-spacing: .04em;
  color: var(--cyan); text-shadow: 0 0 18px rgba(56, 189, 248, .6), 0 4px 0 #082f49;
}
.panel h1 span { color: var(--lime); }
.panel h2 { font-family: var(--display); font-size: 10px; letter-spacing: .14em; color: var(--muted); margin-bottom: 6px; }

.tagline { font-size: 1.35rem; line-height: 1.2; color: var(--muted); margin: 12px 0 16px; }

.statRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; padding: 9px 4px; }
.stat small { display: block; font-family: var(--display); font-size: 6px; color: var(--muted); letter-spacing: .1em; }
.stat strong { display: block; font-family: var(--display); font-size: 10px; color: var(--text); margin-top: 6px; }

.bigScore {
  display: block; font-family: var(--display); font-size: 30px; color: var(--cyan);
  margin: 4px 0 16px; text-shadow: 0 0 20px rgba(56, 189, 248, .55);
}

.grade {
  display: inline-block; font-family: var(--display); font-size: 34px; color: var(--lime);
  margin-bottom: 10px; text-shadow: 0 0 22px rgba(163, 230, 53, .55);
}
.grade.g-A { color: var(--cyan); text-shadow: 0 0 22px rgba(56, 189, 248, .55); }
.grade.g-B { color: var(--yellow); text-shadow: 0 0 22px rgba(250, 204, 21, .45); }
.grade.g-C, .grade.g-D { color: var(--muted); text-shadow: none; }

/* chunky arcade buttons */

.btn {
  display: block; width: 100%;
  font-family: var(--display); font-size: 10px; letter-spacing: .1em;
  border: 0; border-radius: .7rem;
  padding: 15px 10px 13px;
  margin-top: 9px;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(4px); box-shadow: none !important; }

.btnPrimary { background: var(--cyan); color: #04233a; box-shadow: 0 4px 0 #0369a1; }
.btnLime    { background: var(--lime); color: #1a2e05; box-shadow: 0 4px 0 #4d7c0f; }
.btnGhost   { background: var(--surface); color: var(--muted); box-shadow: 0 4px 0 #0f1c3d; }

/* slow diagonal shine on the main CTA */
.btnPrimary::after, .btnLime::after {
  content: ""; position: absolute; top: -60%; left: -40%; width: 30%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(18deg);
  animation: shine 3.4s linear infinite;
}
@keyframes shine { 0% { left: -40%; } 55%, 100% { left: 130%; } }

.foot { margin-top: 14px; font-size: 1.05rem; color: var(--muted); letter-spacing: .04em; }

.newDex {
  background: var(--surface); border: 1px solid #3f6212; border-radius: .6rem;
  padding: 9px 10px; margin-bottom: 12px;
}
.newDex b { display: block; font-family: var(--display); font-size: 7px; color: var(--lime); letter-spacing: .1em; margin-bottom: 5px; }
.newDex span { font-size: 1.3rem; color: var(--text); }

.xpRows { margin-bottom: 14px; display: grid; gap: 6px; }
.xpRow {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: .5rem;
  padding: 7px 10px;
  font-family: var(--display); font-size: 7px; letter-spacing: .08em;
}
.xpRow i { font-style: normal; color: var(--lime); }
.xpRow.up i { color: var(--yellow); }

/* LED dot on the round counter when the signal is critical */
.led {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--red); margin-left: 5px; vertical-align: middle;
  animation: blink .5s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .15; } }

@media (max-height: 620px) {
  .tagline { margin: 8px 0 12px; }
  .btn { padding: 12px 10px 10px; }
  .dexCard p { display: none; }
}
