/* ============================================================
   GRUMU — Stage 0
   ============================================================ */

:root {
  --bg:        #07070a;
  --panel:     #0d0e13;
  --line:      #23242e;
  --ink:       #e9e6df;
  --dim:       #7c7d8c;
  --amber:     #ffb545;
  --amber-hot: #ff7a18;
  --green:     #46e08a;
  --red:       #ff4d4d;
  --mono: "Consolas", "SFMono-Regular", "DejaVu Sans Mono", "Courier New", monospace;
  --pulse: 3.5s;
  --vitality: 0.82;      /* 1 = полон сил, 0 = на грани */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  display: flex;
  justify-content: center;
  padding: 32px 16px 64px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- фон ---------------------------------------------------- */

.bg-glow {
  position: fixed;
  inset: -20vh -20vw;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(38% 42% at 50% 34%, rgba(255,140,40,0.18), transparent 70%),
    radial-gradient(60% 60% at 50% 110%, rgba(90,40,10,0.35), transparent 70%);
  filter: blur(6px);
  opacity: calc(0.35 + var(--vitality) * 0.65);
  transition: opacity 0.8s ease;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.022) 0px,
    rgba(255,255,255,0.022) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- каркас ------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ---------- заголовок ---------------------------------------------- */

.hud-head { text-align: center; }

.logo {
  font-size: clamp(38px, 11vw, 62px);
  letter-spacing: 0.22em;
  font-weight: 800;
  text-indent: 0.22em;
  color: #fff6e6;
  text-shadow:
    0 0 6px  rgba(255,190,110,0.9),
    0 0 26px rgba(255,140,40,0.65),
    0 0 70px rgba(255,90,10,0.35);
  animation: logo-breathe var(--pulse) ease-in-out infinite;
}

@keyframes logo-breathe {
  0%, 100% { text-shadow: 0 0 6px rgba(255,190,110,0.85), 0 0 24px rgba(255,140,40,0.55), 0 0 60px rgba(255,90,10,0.28); }
  50%      { text-shadow: 0 0 10px rgba(255,210,150,1),  0 0 40px rgba(255,150,50,0.8),  0 0 110px rgba(255,90,10,0.5); }
}

.tag {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--dim);
}

/* ---------- сцена с яйцом ------------------------------------------ */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 0 4px;
}

.glow {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 330px;
  height: 330px;
  transform: translate(-50%, -50%) scale(calc(0.55 + var(--vitality) * 0.75));
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,150,50,0.55), rgba(255,90,10,0.18) 45%, transparent 70%);
  filter: blur(14px);
  opacity: calc(0.15 + var(--vitality) * 0.85);
  transition: opacity 0.6s ease, transform 0.6s ease, width 0.5s ease, height 0.5s ease;
  animation: glow-pulse var(--pulse) ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { filter: blur(14px) brightness(0.9); }
  50%      { filter: blur(18px) brightness(1.25); }
}

.egg-wrap {
  position: relative;
  width: min(320px, 74vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transition: transform 0.18s cubic-bezier(.2,.9,.3,1.4);
}

/* ---------- Stage 1 preview -------------------------------------- */

.stage1-creature {
  display: block;
  width: min(134%, 102vw);
  max-width: none;
  height: auto;

  grid-area: 1 / 1;

  object-fit: contain;

  transform: translateY(2%);
  transform-origin: 50% 58%;

  filter:
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 34px rgba(255, 104, 18, 0.30));

  user-select: none;
  pointer-events: none;
}

.stage1-creature[hidden] {
  display: none;
}

.egg-wrap.stage1-preview .egg {
  display: none;
}

.egg-wrap.stage1-preview {
  width: min(390px, 88vw);
  transition: transform 0.18s cubic-bezier(.2,.9,.3,1.4), width 0.45s ease;
}

.stage.stage1-preview .glow {
  width: 410px;
  height: 410px;
  top: 40%;
  opacity: calc(0.22 + var(--vitality) * 0.78);
}

/* ---------- Stage 2 preview -------------------------------------- */

.stage2-creature {
  display: block;
  width: min(150%, 112vw);
  max-width: none;
  height: auto;

  grid-area: 1 / 1;

  object-fit: contain;

  transform: translateY(1%) scale(1);
  transform-origin: 50% 58%;

  filter:
    drop-shadow(0 20px 32px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 40px rgba(255, 92, 12, 0.34));

  user-select: none;
  pointer-events: none;
}

.stage2-creature[hidden] {
  display: none;
}

.egg-wrap.stage2-preview .egg {
  display: none;
}

.egg-wrap.stage2-preview {
  width: min(430px, 94vw);
  transition:
    transform 0.18s cubic-bezier(.2,.9,.3,1.4),
    width 0.45s ease;
}

.stage.stage2-preview .glow {
  width: 450px;
  height: 450px;
  top: 39%;
  opacity: calc(0.26 + var(--vitality) * 0.74);
}

/* ---------- Stage 1 -> Stage 2 evolution ------------------------- */

@keyframes evolution-charge {
  0% {
    transform: translateY(2%) scale(1);
    filter:
      brightness(1)
      saturate(1)
      drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58))
      drop-shadow(0 0 34px rgba(255, 104, 18, 0.30));
  }

  35% {
    transform: translateY(2%) scale(1.025);
    filter:
      brightness(1.18)
      saturate(1.18)
      drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58))
      drop-shadow(0 0 46px rgba(255, 112, 18, 0.52));
  }

  70% {
    transform: translateY(1%) scale(1.055);
    filter:
      brightness(1.48)
      saturate(1.35)
      drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58))
      drop-shadow(0 0 64px rgba(255, 132, 24, 0.78));
  }

  100% {
    transform: translateY(0) scale(1.09);
    filter:
      brightness(1.9)
      saturate(1.45)
      drop-shadow(0 0 76px rgba(255, 155, 42, 0.95));
  }
}

.stage1-creature.evolution-source {
  animation:
    evolution-charge 2050ms
    cubic-bezier(.2,.7,.25,1)
    both;
}

@keyframes evolution-source-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1.09);
    filter:
      brightness(1.9)
      saturate(1.45)
      drop-shadow(0 0 76px rgba(255, 155, 42, 0.95));
  }

  to {
    opacity: 0;
    transform: translateY(-1%) scale(1.16);
    filter:
      blur(8px)
      brightness(2.5)
      saturate(1.6)
      drop-shadow(0 0 100px rgba(255, 180, 70, 1));
  }
}

.stage1-creature.evolution-source-out {
  animation:
    evolution-source-out 300ms
    ease-in both;
}

@keyframes evolution-emerge {
  0% {
    opacity: 0;
    transform: translateY(5%) scale(0.84);
    filter:
      blur(10px)
      brightness(2.2)
      saturate(1.45)
      drop-shadow(0 0 90px rgba(255, 150, 42, 0.95));
  }

  42% {
    opacity: 1;
    transform: translateY(0) scale(1.06);
    filter:
      blur(2px)
      brightness(1.45)
      saturate(1.2)
      drop-shadow(0 0 62px rgba(255, 112, 18, 0.65));
  }

  100% {
    opacity: 1;
    transform: translateY(1%) scale(1);
    filter:
      blur(0)
      brightness(1)
      saturate(1)
      drop-shadow(0 20px 32px rgba(0, 0, 0, 0.62))
      drop-shadow(0 0 40px rgba(255, 92, 12, 0.34));
  }
}

.stage2-creature.evolution-emerge {
  animation:
    evolution-emerge 1150ms
    cubic-bezier(.18,.88,.28,1.08)
    both;
}

.stage.evolution-transition .glow {
  width: 520px;
  height: 520px;
  top: 37%;
  opacity: calc(0.42 + var(--vitality) * 0.58);
  filter: blur(20px) brightness(1.45);
}
/* ---------- Hatch transition (preview) ---------------------------- */

/* Во время hatch яйцо должно оставаться видимым, несмотря на .stage1-preview. */
.egg-wrap.stage1-preview.hatch-active .egg {
  display: block;
}

@keyframes hatch-egg-shake {
  0%   { transform: translateX(0) rotate(0deg) scale(1); filter: brightness(1) drop-shadow(0 0 0 rgba(255, 140, 40, 0)); }
  12%  { transform: translateX(-2px) rotate(-0.4deg) scale(1.005); filter: brightness(1.05) drop-shadow(0 0 6px rgba(255, 140, 40, 0.25)); }
  22%  { transform: translateX(2px) rotate(0.4deg) scale(1.01); filter: brightness(1.08) drop-shadow(0 0 8px rgba(255, 140, 40, 0.30)); }
  31%  { transform: translateX(-3px) rotate(-0.7deg) scale(1.015); filter: brightness(1.12) drop-shadow(0 0 10px rgba(255, 135, 35, 0.38)); }
  39%  { transform: translateX(4px) rotate(0.8deg) scale(1.02); filter: brightness(1.16) drop-shadow(0 0 12px rgba(255, 130, 30, 0.45)); }
  47%  { transform: translateX(-5px) rotate(-1deg) scale(1.03); filter: brightness(1.20) drop-shadow(0 0 14px rgba(255, 125, 25, 0.52)); }
  55%  { transform: translateX(6px) rotate(1.2deg) scale(1.04); filter: brightness(1.24) drop-shadow(0 0 16px rgba(255, 120, 20, 0.60)); }
  63%  { transform: translateX(-8px) rotate(-1.6deg) scale(1.05); filter: brightness(1.30) drop-shadow(0 0 20px rgba(255, 118, 18, 0.68)); }
  71%  { transform: translateX(9px) rotate(1.8deg) scale(1.06); filter: brightness(1.34) drop-shadow(0 0 22px rgba(255, 116, 16, 0.75)); }
  79%  { transform: translateX(-11px) rotate(-2.2deg) scale(1.07); filter: brightness(1.40) drop-shadow(0 0 26px rgba(255, 114, 14, 0.82)); }
  87%  { transform: translateX(12px) rotate(2.6deg) scale(1.08); filter: brightness(1.48) drop-shadow(0 0 30px rgba(255, 112, 12, 0.90)); }
  94%  { transform: translateX(-7px) rotate(-1.4deg) scale(1.05); filter: brightness(1.30) drop-shadow(0 0 22px rgba(255, 120, 20, 0.70)); }
  100% { transform: translateX(0) rotate(0deg) scale(1.02); filter: brightness(1.25) drop-shadow(0 0 18px rgba(255, 120, 20, 0.60)); }
}

.egg.hatch-egg {
  animation: hatch-egg-shake 1350ms cubic-bezier(.33,.06,.6,1) both;
}

@keyframes hatch-egg-collapse {
  0%   { transform: scale(1.02); opacity: 1; filter: brightness(1.25); }
  40%  { transform: scale(1.10); opacity: 0.85; filter: brightness(1.60); }
  100% { transform: scale(0.50); opacity: 0; filter: brightness(2); }
}

.egg.hatch-collapse {
  animation: hatch-egg-collapse 300ms ease-in both;
}

@keyframes hatch-emerge {
  0%   { opacity: 0; transform: translateY(8%) scale(0.82); filter: blur(7px) brightness(1.7) drop-shadow(0 0 44px rgba(255, 150, 50, 0.75)); }
  45%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(2%) scale(1); filter: blur(0) brightness(1) drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58)) drop-shadow(0 0 34px rgba(255, 104, 18, 0.30)); }
}

.stage1-creature.hatch-emerge {
  animation: hatch-emerge 850ms cubic-bezier(.2,.9,.3,1.05) both;
}

/* Сцена на пике: glow раздувается. */
.stage.hatch-transition .glow {
  width: 470px;
  height: 470px;
  top: 38%;
  opacity: calc(0.35 + var(--vitality) * 0.65);
}

.egg-wrap.hit   { transform: scale(0.965) rotate(-1.2deg); }
.egg-wrap.feed  { transform: scale(1.05); }
.egg-wrap.shake { animation: shake 0.42s cubic-bezier(.36,.07,.19,.97) both; }
.egg-wrap.crack { animation: crack-jolt 0.7s ease-out both; }

/* --------- MARKET REACTION INTENSITY ----------------------------- */

/*
 * reaction-* намеренно не использует transform или animation
 * на самом .egg-wrap:
 *
 * transform остаётся за .feed / .hit
 * animation остаётся за .shake / .crack
 */

.egg-wrap.reaction-big {
  filter:
    brightness(1.14)
    saturate(1.18)
    drop-shadow(0 0 18px rgba(255, 154, 52, 0.72))
    drop-shadow(0 0 42px rgba(255, 104, 18, 0.38));
}

.egg-wrap.reaction-whale {
  filter:
    brightness(1.28)
    saturate(1.32)
    drop-shadow(0 0 24px rgba(255, 190, 82, 0.95))
    drop-shadow(0 0 58px rgba(255, 112, 18, 0.68))
    drop-shadow(0 0 92px rgba(255, 72, 8, 0.32));
}

/* Энергетическое кольцо. Оно анимируется отдельно от egg-wrap. */
.egg-wrap::after {
  content: "";
  position: absolute;
  inset: 7%;
  z-index: 4;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  border: 1px solid rgba(255, 190, 90, 0);
  box-shadow: 0 0 0 rgba(255, 140, 40, 0);
}

.egg-wrap.reaction-big::after {
  animation: reaction-ring-big 0.9s ease-out both;
}

.egg-wrap.reaction-whale::after {
  animation: reaction-ring-whale 1.3s ease-out both;
}

@keyframes reaction-ring-big {
  0% {
    inset: 16%;
    opacity: 0;
    border-color: rgba(255, 215, 140, 0.9);
    box-shadow:
      0 0 18px rgba(255, 175, 70, 0.72),
      inset 0 0 18px rgba(255, 145, 40, 0.35);
  }

  18% {
    opacity: 0.95;
  }

  100% {
    inset: -5%;
    opacity: 0;
    border-color: rgba(255, 150, 55, 0);
    box-shadow:
      0 0 54px rgba(255, 120, 25, 0),
      inset 0 0 28px rgba(255, 120, 25, 0);
  }
}

@keyframes reaction-ring-whale {
  0% {
    inset: 18%;
    opacity: 0;
    border: 2px solid rgba(255, 245, 205, 1);
    box-shadow:
      0 0 22px rgba(255, 225, 150, 0.95),
      0 0 52px rgba(255, 150, 45, 0.8),
      inset 0 0 28px rgba(255, 190, 80, 0.55);
  }

  14% {
    opacity: 1;
  }

  45% {
    opacity: 0.72;
  }

  100% {
    inset: -13%;
    opacity: 0;
    border-color: rgba(255, 120, 25, 0);
    box-shadow:
      0 0 90px rgba(255, 105, 15, 0),
      0 0 130px rgba(255, 70, 5, 0),
      inset 0 0 36px rgba(255, 120, 25, 0);
  }
}

/* --------- SELL REACTION INTENSITY ------------------------------- */

.egg-wrap.reaction-sell-big {
  filter:
    brightness(0.82)
    saturate(0.82)
    drop-shadow(0 0 18px rgba(255, 62, 42, 0.68))
    drop-shadow(0 0 42px rgba(170, 18, 12, 0.34));
}

.egg-wrap.reaction-sell-whale {
  filter:
    brightness(0.64)
    saturate(0.68)
    contrast(1.12)
    drop-shadow(0 0 24px rgba(255, 48, 38, 0.92))
    drop-shadow(0 0 58px rgba(170, 12, 8, 0.58))
    drop-shadow(0 0 90px rgba(90, 0, 0, 0.32));
}

.egg-wrap.reaction-sell-big::after {
  animation: reaction-damage-big 0.95s ease-out both;
}

.egg-wrap.reaction-sell-whale::after {
  animation: reaction-damage-whale 1.4s ease-out both;
}

@keyframes reaction-damage-big {
  0% {
    inset: -5%;
    opacity: 0;
    border-color: rgba(255, 90, 70, 0);
    box-shadow: 0 0 48px rgba(255, 40, 25, 0);
  }

  20% {
    inset: 5%;
    opacity: 0.95;
    border-color: rgba(255, 100, 80, 0.9);
    box-shadow:
      0 0 28px rgba(255, 45, 30, 0.72),
      inset 0 0 24px rgba(160, 10, 5, 0.42);
  }

  100% {
    inset: 16%;
    opacity: 0;
    border-color: rgba(150, 15, 10, 0);
    box-shadow:
      0 0 8px rgba(120, 0, 0, 0),
      inset 0 0 12px rgba(90, 0, 0, 0);
  }
}

@keyframes reaction-damage-whale {
  0% {
    inset: -12%;
    opacity: 0;
    border: 2px solid rgba(255, 65, 55, 0);
    box-shadow:
      0 0 80px rgba(255, 20, 15, 0),
      inset 0 0 50px rgba(120, 0, 0, 0);
  }

  16% {
    inset: 1%;
    opacity: 1;
    border-color: rgba(255, 80, 65, 1);
    box-shadow:
      0 0 50px rgba(255, 35, 25, 0.9),
      0 0 90px rgba(140, 5, 0, 0.55),
      inset 0 0 42px rgba(120, 0, 0, 0.62);
  }

  48% {
    inset: 7%;
    opacity: 0.72;
  }

  100% {
    inset: 19%;
    opacity: 0;
    border-color: rgba(120, 0, 0, 0);
    box-shadow:
      0 0 12px rgba(100, 0, 0, 0),
      inset 0 0 18px rgba(70, 0, 0, 0);
  }
}

@keyframes shake {
  10%, 90% { transform: translateX(-3px) rotate(-1deg); }
  20%, 80% { transform: translateX(5px) rotate(1.2deg); }
  30%, 50%, 70% { transform: translateX(-7px) rotate(-1.6deg); }
  40%, 60% { transform: translateX(7px) rotate(1.6deg); }
}

@keyframes crack-jolt {
  0%   { transform: scale(1); }
  15%  { transform: scale(1.08); }
  30%  { transform: scale(0.97) rotate(-2deg); }
  50%  { transform: scale(1.04) rotate(2deg); }
  100% { transform: scale(1); }
}

.egg {
  /* Та же ячейка грида, что у .stage1-creature: яйцо и GRUMU */
  /* должны занимать одно место, а не вставать двумя рядами. */
  grid-area: 1 / 1;

  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  user-select: none;
  -webkit-user-drag: none;
  filter:
    saturate(calc(0.55 + var(--vitality) * 0.55))
    brightness(calc(0.42 + var(--vitality) * 0.72))
    contrast(1.08);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 56%, transparent 71%);
          mask-image: radial-gradient(circle at 50% 50%, #000 56%, transparent 71%);
  transition: filter 0.7s ease;
  animation: egg-breathe var(--pulse) ease-in-out infinite;
}

@keyframes egg-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.022); }
}

/* искры вокруг яйца */
.embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
}

.ember {
  position: absolute;
  bottom: 12%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px 2px rgba(255,160,60,0.85);
  opacity: 0;
  animation: rise var(--dur) linear infinite;
  animation-delay: var(--delay);
}

@keyframes rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  12%  { opacity: 0.9; }
  100% { transform: translateY(-190px) translateX(var(--drift)) scale(0.2); opacity: 0; }
}

/* ярлык стадии */
.stage-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.28em;
}

.stage-tag {
  padding: 3px 9px;
  border: 1px solid rgba(255,170,70,0.45);
  color: var(--amber);
  background: rgba(255,140,40,0.07);
}

.stage-name { color: var(--dim); }

/* тревожная плашка "что-то происходит" */
.alert {
  width: 100%;
  max-width: 380px;
  padding: 12px 16px;
  border: 1px solid rgba(255,80,60,0.55);
  background: linear-gradient(180deg, rgba(255,60,30,0.14), rgba(255,60,30,0.04));
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.16em;
  display: none;
  animation: alert-in 0.45s ease both;
}

.alert.show { display: block; }

.alert-line {
  color: #ff8a72;
  font-weight: 700;
  animation: blink 1.15s steps(2, start) infinite;
}

.alert-row { margin-top: 7px; color: var(--dim); font-size: 11px; }
.alert .unknown {
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.3em;
  text-shadow: 0 0 16px rgba(255,120,60,0.9);
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes alert-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- показатели --------------------------------------------- */

.stats { display: flex; flex-direction: column; gap: 16px; }

.stat-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--dim);
  margin-bottom: 7px;
}

.stat-top span:last-child { color: var(--ink); letter-spacing: 0.12em; }

.bar {
  height: 14px;
  border: 1px solid var(--line);
  background: #0a0b0f;
  padding: 2px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1f8f52, var(--green));
  box-shadow: 0 0 14px rgba(70,224,138,0.45);
  transition: width 0.5s cubic-bezier(.3,.9,.3,1), background 0.5s ease, box-shadow 0.5s ease;
}

.bar i.warn { background: linear-gradient(90deg, #a87716, var(--amber)); box-shadow: 0 0 14px rgba(255,181,69,0.45); }
.bar i.crit { background: linear-gradient(90deg, #8c1f1f, var(--red)); box-shadow: 0 0 16px rgba(255,77,77,0.5); animation: blink 1s steps(2,start) infinite; }

.bar.evo { height: 18px; }

.bar.evo i {
  background: linear-gradient(90deg, #ff5c00, var(--amber), #ffe6a8);
  box-shadow: 0 0 18px rgba(255,150,50,0.6);
  position: relative;
}

.bar.evo i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: translateX(-100%);
  animation: sweep 2.4s linear infinite;
}

@keyframes sweep { to { transform: translateX(100%); } }

.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.counter {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.counter span { font-size: 10px; letter-spacing: 0.3em; color: var(--dim); }
.counter b { font-size: 22px; color: #fff3dd; font-weight: 700; letter-spacing: 0.06em; }

/* ---------- настроение --------------------------------------------- */

.mood {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--amber);
  padding: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: color 0.5s ease;
}

.mood.crit { color: var(--red); animation: blink 0.9s steps(2,start) infinite; }

/* ---------- кнопки --------------------------------------------------- */

.controls { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* UTF-8: author-правило .controls перебивает UA-правило [hidden],
   поэтому hidden нужно подтвердить явно. */
.controls[hidden] {
  display: none;
}

.controls { flex-direction: row; flex-wrap: wrap; justify-content: center; }

.btn {
  flex: 1 1 190px;
  min-width: 150px;
  padding: 18px 22px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  cursor: pointer;
  background: transparent;
  border: 1px solid;
  transition: transform 0.12s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.btn:active { transform: translateY(2px) scale(0.985); }

.btn.buy  { color: #d8ffe8; border-color: rgba(70,224,138,0.55); background: rgba(70,224,138,0.08); box-shadow: 0 0 22px rgba(70,224,138,0.14) inset; }
.btn.buy:hover  { background: rgba(70,224,138,0.18); box-shadow: 0 0 26px rgba(70,224,138,0.35); }

.btn.sell { color: #ffdede; border-color: rgba(255,77,77,0.5); background: rgba(255,77,77,0.07); box-shadow: 0 0 22px rgba(255,77,77,0.12) inset; }
.btn.sell:hover { background: rgba(255,77,77,0.16); box-shadow: 0 0 26px rgba(255,77,77,0.32); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.note {
  flex-basis: 100%;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--dim);
}

/* ---------- TRADE: BUY / SELL -> Raydium --------------------------- */

.trade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.trade-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.trade-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.trade-note {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--dim);
}

.trade-caption {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--amber);
  text-align: center;
}

.trade-ca {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.78rem;
}

.trade-ca-label {
  opacity: 0.58;
  letter-spacing: 0.08em;
}

.trade-ca-value {
  font: inherit;
  opacity: 0.82;
  white-space: nowrap;
}

.trade-ca-copy {
  flex: 0 0 auto;
}

/* ---------- лента событий -------------------------------------------- */

.feed { border: 1px solid var(--line); background: rgba(13,14,19,0.72); }

.feed h2 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  color: var(--dim);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.feed ul {
  list-style: none;
  max-height: 232px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2c2d38 transparent;
}

.feed ul::-webkit-scrollbar { width: 6px; }
.feed ul::-webkit-scrollbar-thumb { background: #2c2d38; }

.feed li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(35,36,46,0.6);
  animation: feed-in 0.35s ease both;
}

.feed li:last-child { border-bottom: none; }

@keyframes feed-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.feed li .dot { flex: 0 0 auto; font-size: 11px; line-height: 1.5; }
.feed li .txt { color: var(--ink); }
.feed li .txt small { display: block; color: var(--dim); font-size: 11px; margin-top: 3px; letter-spacing: 0.12em; }
.feed li .amt { margin-left: auto; font-weight: 700; white-space: nowrap; }

.feed li.up   .dot, .feed li.up   .amt { color: var(--green); }
.feed li.down .dot, .feed li.down .amt { color: var(--red); }
.feed li.warn .dot, .feed li.warn .amt { color: var(--amber); }

/* ---------- подвал ---------------------------------------------------- */

.hud-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--dim);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.hud-foot b { color: var(--amber-hot); }

.reset {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 7px 12px;
  cursor: pointer;
}

.reset:hover { color: var(--ink); border-color: var(--dim); }

/* ---------- вспышки на весь экран -------------------------------------- */

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
}

.flash.go { animation: flash 0.5s ease-out; }
.flash.red   { background: radial-gradient(circle at 50% 40%, rgba(255,40,40,0.42), transparent 65%); }
.flash.gold  { background: radial-gradient(circle at 50% 40%, rgba(255,190,90,0.40), transparent 65%); }
.flash.white { background: radial-gradient(circle at 50% 42%, rgba(255,255,255,0.85), transparent 70%); }

@keyframes flash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- мобильный --------------------------------------------------- */

/* ---------- TRADE RISK (inline disclosure) ------------------------- */

.trade-risk {
  font-size: 10px;
  letter-spacing: 0.14em;
  line-height: 1.7;
  color: var(--dim);
  text-align: center;
  max-width: 470px;
}

.info-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: var(--amber);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-link:hover { color: var(--amber-hot); }

/* ---------- FOOTER NAV --------------------------------------------- */

.hud-foot { flex-wrap: wrap; }

.hud-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: flex-end;
}

.hud-nav .info-link {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-decoration: none;
}

.hud-nav .info-link:hover { color: var(--ink); }

/* ---------- INFO MODAL --------------------------------------------- */

body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3,3,5,0.74);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  padding: 20px 22px 22px;
  animation: modal-in 0.22s ease both;
  scrollbar-width: thin;
  scrollbar-color: #2c2d38 transparent;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--amber);
}

.modal-close {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  padding: 6px 9px;
  cursor: pointer;
}

.modal-close:hover { color: var(--ink); border-color: var(--dim); }

.modal-body { font-size: 12.5px; line-height: 1.8; color: var(--ink); }
.modal-body p { margin-bottom: 12px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body b { color: #fff3dd; }

.token-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 16px;
  margin-bottom: 14px;
}

.token-facts dt {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--dim);
  align-self: center;
}

.token-facts dd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.token-facts code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber-hot);
  user-select: all;
  word-break: break-all;
}

.copy-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 5px 8px;
  cursor: pointer;
}

.copy-btn:hover { color: var(--ink); border-color: var(--dim); }
.copy-btn.done { color: var(--green); border-color: rgba(70,224,138,0.5); }

.token-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.token-links a { color: var(--amber); text-decoration: none; }
.token-links a:hover { color: var(--amber-hot); }
.token-note { font-size: 11px; color: var(--dim); }

/* ---------- MARKET LOADING STATE ----------------------------------- */

.market {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.market-state {
  visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.market-state.ready { visibility: visible; }

.market-wait {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--dim);
  animation: wait-blink 1.8s ease-in-out infinite;
}

.market-wait[hidden] { display: none; }

@keyframes wait-blink {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

@media (max-width: 460px) {
  body { padding: 22px 12px 48px; }
  .btn { flex-basis: 100%; padding: 16px; font-size: 14px; }
  .counter b { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
