:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #22252e;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #3b82f6;
  --border: #2a2f3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 20px 120px 20px;
}

/* Telegram блок */

.content-text {
  background: var(--card);
  padding: 40px;
  border-radius: 16px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

/* Картинка */

.content-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.image-link {
  display: block;
  width: min(760px, 100%);
  text-decoration: none;
  cursor: pointer;
}

.content-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  filter: blur(16px) saturate(0.9);
  transform: scale(1.04);
  animation: blurPulse 2.2s ease-in-out both;
}

.content-image.is-error img {
  animation: none;
  filter: blur(18px) saturate(0.8);
}

/* Кнопка скачать */

.download-button {
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
  min-width: 160px;
  text-align: center;
}

.status-card {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.status-card.is-error {
  animation: shake 0.35s ease-in-out;
}

.no-js .status-card {
  animation: shake 0.35s ease-in-out;
}

.no-js .status-spinner {
  display: none;
}

.no-js .content-image img {
  animation: none;
  filter: blur(18px) saturate(0.8);
}

.status-title {
  font-weight: 600;
  font-size: 18px;
}

.status-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.status-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.status-card.is-error .status-spinner {
  display: none;
}

.status-error {
  color: #fca5a5;
  font-size: 14px;
}

.download-button:hover {
  opacity: 0.9;
}

/* ===================== */
/* ЧАТ */
/* ===================== */

.chat-widget {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 340px;
  height: 460px;
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */

.chat-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.chat-title {
  font-weight: 600;
}

.chat-status {
  font-size: 12px;
  color: var(--muted);
}

/* Body */

.chat-body {
  flex: 1;
  padding: 16px;
  background: var(--card-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 75%;
  line-height: 1.4;
  font-size: 14px;
}

.chat-message.bot {
  background: #2a2f3a;
  align-self: flex-start;
}

.chat-message.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
}

/* Кнопка скачать в чате */

.chat-download {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 14px;
}

/* Input */

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.chat-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #111318;
  color: var(--text);
  outline: none;
}

.chat-input::placeholder {
  color: var(--muted);
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-send {
  padding: 8px 14px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.chat-send:hover {
  opacity: 0.9;
}

/* ===================== */
/* Responsive */
/* ===================== */

@media (max-width: 900px) {
  .page {
    padding: 40px 16px 100px 16px;
  }

  .chat-widget {
    right: 16px;
    bottom: 16px;
    width: min(360px, calc(100vw - 32px));
    height: 420px;
    border-radius: 18px;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 18px 12px 16px 12px;
  }

  .chat-widget {
    position: static;
    width: 100%;
    height: auto;
    margin-top: 24px;
    border-radius: 16px;
  }

  .chat-body {
    flex: 0 1 auto;
    max-height: 45vh;
  }

  .chat-input-area {
    flex-wrap: wrap;
  }

  .chat-send {
    width: 100%;
  }

  .content-image {
    gap: 12px;
  }

  .status-card {
    padding: 14px;
    border-radius: 16px;
  }

  .status-title {
    font-size: 16px;
  }

  .download-button {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 16px;
  }
}

@media (max-width: 520px) {
  .redirect-body {
    align-items: flex-start;
  }

  .redirect-page {
    margin-top: 16px;
  }
}

/* ===================== */
/* Redirect Page */
/* ===================== */

.redirect-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1100px 600px at 12% -10%, #1b2533 0%, transparent 60%),
    radial-gradient(900px 520px at 88% 110%, #141b26 0%, transparent 55%),
    var(--bg);
}

.redirect-page {
  width: min(560px, 94vw);
  padding: 12px;
}

.redirect-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.redirect-image {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.redirect-image img {
  width: 100%;
  display: block;
  filter: blur(16px) saturate(0.9);
  transform: scale(1.06);
  animation: blurPulse 2.4s ease-in-out;
}

.redirect-card.is-error .redirect-image img {
  animation: none;
  filter: blur(18px) saturate(0.8);
}

.redirect-spinner {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.redirect-card.is-error .redirect-spinner {
  display: none;
}

.redirect-title {
  font-size: 18px;
  font-weight: 600;
}

.redirect-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.redirect-error {
  color: #fca5a5;
  font-size: 14px;
}

.retry-button {
  display: inline-block;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
  width: 100%;
  text-align: center;
}

.retry-button:hover {
  opacity: 0.9;
}

@keyframes blurPulse {
  0% {
    filter: blur(22px) saturate(0.8);
  }
  60% {
    filter: blur(10px) saturate(1);
  }
  100% {
    filter: blur(18px) saturate(0.85);
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
