/* =========================
   ROOT: РАЗМЕРЫ И ПОЗИЦИИ
========================= */

:root {
  /* Размер сцены */
  --scene-width: 1920px;
  --scene-height: 1080px;

  /* Фон PNG */
  --background-image: url("background.png");

  /* Заголовок CAT WITH HAT */
  --title-top: 40%;
  --title-left: 18%;
  --title-font-size: 140px;

  /* CA адрес */
  --ca-top: 3%;
  --ca-left: 50%;
  --ca-transform-x: -50%;
  --ca-font-size: 32px;

  /* Главный персонаж */
  --character-width: 380px;
  --character-top: 45%;
  --character-left: 60%;

  /* Нижние кнопки (общая позиция блока) */
  --footer-right: 5%;
  --footer-bottom: 1%;

  /* Глобальный геп между иконками */
  --footer-buttons-gap: 45px;

  /* Индивидуальные оффсеты по X для каждой кнопки */
  --footer-btn-1-offset: -160px; /* X */
  --footer-btn-2-offset: -85px;  /* Pill */
  --footer-btn-3-offset: -10px;  /* Telegram */

  /* Размер кнопки */
  --footer-btn-width: 70px;

  /* Тостер */
  --toast-bottom: 12%;
  --toast-font-size: 26px;

  /* PET A CAT */
  --pet-text-top: 25%;
  --pet-text-left: 60%;
  --pet-text-size: 40px;

  /* Анимации */
  --title-sway-duration: 3s;
  --mouse-run-duration: 0.5s;
}

/* =========================
   БАЗА
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

/* Кастомный курсор */
body,
.scene,
a,
button,
.footer-btn,
.footer-btn img,
.ca-wrapper,
#main-character,
.mouse,
.pet-text,
.title,
.toast {
  cursor: url("cursor.png") 16 16, auto;
}

/* =========================
   СЦЕНА
========================= */

.scene {
  position: relative;
  width: var(--scene-width);
  height: var(--scene-height);
  overflow: hidden;

  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
}

/* =========================
   CA: АДРЕС КОНТРАКТА
========================= */

.ca-wrapper {
  position: absolute;
  top: var(--ca-top);
  left: var(--ca-left);
  transform: translateX(var(--ca-transform-x));

  padding: 6px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;

  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.ca-text {
  font-family: "Just Another Hand", cursive;
  font-size: var(--ca-font-size);
  color: #fff;
}

.ca-address {
  max-width: 36vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ca-wrapper:hover {
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.55);
}

.ca-wrapper:active {
  transform: translateX(var(--ca-transform-x)) scale(0.98);
}

.hidden {
  display: none !important;
}

/* =========================
   TITLE
========================= */

.title {
  position: absolute;
  top: var(--title-top);
  left: var(--title-left);

  font-family: "Just Another Hand", cursive;
  font-size: var(--title-font-size);
  margin: 0;
  color: #000;

  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.8);
  animation: title-sway var(--title-sway-duration) ease-in-out infinite;
}

@keyframes title-sway {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-1.4deg); }
  50%  { transform: rotate(1.4deg); }
  75%  { transform: rotate(-1deg); }
  100% { transform: rotate(0deg); }
}

/* =========================
   PET A CAT (дрожащий текст)
========================= */

.pet-text {
  position: absolute;
  top: var(--pet-text-top);
  left: var(--pet-text-left);
  transform: translate(-50%, -50%);

  font-family: "Just Another Hand", cursive;
  font-size: var(--pet-text-size);
  color: #ffffff;
  letter-spacing: 3px;

  animation: petshake 0.12s infinite steps(2);
}

@keyframes petshake {
  0%   { transform: translate(-50%, -50%) translate(1px, 0px); }
  25%  { transform: translate(-50%, -50%) translate(-1px, -1px); }
  50%  { transform: translate(-50%, -50%) translate(1px, 1px); }
  75%  { transform: translate(-50%, -50%) translate(-1px, 1px); }
  100% { transform: translate(-50%, -50%) translate(0px, -1px); }
}

/* =========================
   CHARACTER
========================= */

.character-wrapper {
  position: absolute;
  top: var(--character-top);
  left: var(--character-left);
  transform: translate(-50%, -50%);
}

.character-image {
  width: var(--character-width);
  transition: transform 0.15s ease-out;
}

.character-image:active {
  transform: scale(0.97);
}

/* =========================
   MICE
========================= */

.mice-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mouse {
  position: absolute;
  width: 130px;
  pointer-events: auto;
  user-select: none;
  transition: transform 0.1s ease-out;
}

.mouse img {
  width: 100%;
}

/* Текст над мышью */
.mouse-text {
  position: absolute;
  bottom: 100%; /* строго над мышью */
  left: 50%;
  transform: translateX(-50%) translateY(-6px);

  font-family: "Just Another Hand", cursive;
  font-size: 26px;       /* чуть больше */
  color: #000000;        /* чёрный */
  white-space: nowrap;   /* без переносов */
  pointer-events: none;

  animation: mouseTextShake 0.14s infinite steps(2);
}

@keyframes mouseTextShake {
  0%   { transform: translateX(-50%) translate(1px, -4px); }
  50%  { transform: translateX(-50%) translate(-1px, -2px); }
  100% { transform: translateX(-50%) translate(0px, -3px); }
}

.mouse-idle {
  animation: mouse-idle 3s ease-in-out infinite;
}

@keyframes mouse-idle {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* Анимации убегания мышей */

.mouse.run-from-left {
  animation: run-right var(--mouse-run-duration) linear forwards;
}

.mouse.run-from-right {
  animation: run-left var(--mouse-run-duration) linear forwards;
}

.mouse.run-from-top {
  animation: run-down var(--mouse-run-duration) linear forwards;
}

.mouse.run-from-bottom {
  animation: run-up var(--mouse-run-duration) linear forwards;
}

@keyframes run-right {
  to {
    transform: translateX(2200px);
    opacity: 0;
  }
}

@keyframes run-left {
  to {
    transform: translateX(-2200px);
    opacity: 0;
  }
}

@keyframes run-down {
  to {
    transform: translateY(1300px);
    opacity: 0;
  }
}

@keyframes run-up {
  to {
    transform: translateY(-1300px);
    opacity: 0;
  }
}

/* =========================
   FOOTER BUTTONS
========================= */

.footer-buttons {
  position: absolute;
  right: var(--footer-right);
  bottom: var(--footer-bottom);
  display: flex;
  gap: var(--footer-buttons-gap);
}

/* Индивидуальные оффсеты */
.footer-btn:nth-child(1) {
  --footer-btn-offset: var(--footer-btn-1-offset);
}

.footer-btn:nth-child(2) {
  --footer-btn-offset: var(--footer-btn-2-offset);
}

.footer-btn:nth-child(3) {
  --footer-btn-offset: var(--footer-btn-3-offset);
}

.footer-btn {
  width: var(--footer-btn-width);
  aspect-ratio: 1 / 1;

  border: none;
  background: transparent !important;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;

  display: flex;
  justify-content: center;
  align-items: center;

  transform: translateX(var(--footer-btn-offset, 0));

  transition:
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out;
}

.footer-btn img {
  width: 100%;
  display: block;
  background: transparent !important;
}

/* Hover */
.footer-btn:hover {
  transform:
    translateX(var(--footer-btn-offset, 0))
    translateY(-6px);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.35);
}

/* Active */
.footer-btn:active {
  transform:
    translateX(var(--footer-btn-offset, 0))
    translateY(2px)
    scale(0.96);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

/* Отключение focus-стилей */
.footer-btn:focus,
.footer-btn:focus-visible,
.footer-btn:focus-within {
  outline: none !important;
  background: transparent !important;
  box-shadow: none;
}

/* =========================
   TOAST
========================= */

.toast {
  position: absolute;
  left: 50%;
  bottom: var(--toast-bottom);
  transform: translateX(-50%) translateY(40px);

  padding: 10px 26px;
  background: rgba(0, 0, 0, 0.78);
  border-radius: 999px;
  color: #fff;

  font-family: "Just Another Hand", cursive;
  font-size: var(--toast-font-size);

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
