/* Telegram.me Page Styles - Exact Background Version */

:root {
  --text-color: #000;
  --accent-btn-color: #2481cc;
  --accent-color-hover: #1a8ad5;
  --body-bg: #fff;
  --box-bg: #fff;
  --box-bg-blured: rgba(255, 255, 255, 0.84);
  --tme-logo-color: #363b40;
  --accent-link-color: #2481cc;
}

html.theme_dark body,
body.bg_dark {
  --text-color: #fff;
  --accent-btn-color: #1c93e3;
  --body-bg: #000;
  --box-bg: #1e1e1e;
  --box-bg-blured: rgba(34, 34, 34, 0.84);
  --tme-logo-color: #fff;
  --accent-link-color: #3ca1eb;
}

body {
  font-family: "Roboto", sans-serif;
  background: var(--body-bg);
  margin: 0;
  padding: 0;
  color: var(--text-color);
}

/* Background - Exact as original */
.tgme_background_wrap {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background: var(--body-bg);
}

.tgme_background {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.tgme_background.motion {
  left: -10px;
  top: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  animation: bg-motion 10s linear infinite;
}

.tgme_background_pattern {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: overlay;
  background: center repeat;
  background-size: 420px auto;
  background-image: var(--pattern-url, none);
  opacity: var(--pattern-intensity, 1);
}

.tgme_background_pattern.default {
  opacity: 0.3;
  background-image: url("pattern.svg");
}

/* Use mask property instead of -webkit-mask */
html.theme_dark .tgme_background,
body.bg_dark .tgme_background {
  mask: center repeat;
  mask-size: 420px auto;
  mask-image: var(--pattern-url, none);
  opacity: var(--pattern-intensity, 1);
}

html.theme_dark .tgme_background.default,
body.bg_dark .tgme_background.default {
  opacity: 0.3;
  mask-image: url("pattern.svg");
}

body.bg_light .tgme_background,
body.bg_light .tgme_background.default {
  mask: none;
  opacity: 1;
}

html.theme_dark .tgme_background_pattern,
body.bg_dark .tgme_background_pattern {
  display: none;
}

body.bg_light .tgme_background_pattern {
  display: block;
}

@keyframes bg-motion {
  20% {
    transform: translateX(0px);
  }
  25% {
    transform: translateX(-10px);
  }
  35% {
    transform: translateX(10px);
  }
  40% {
    transform: translateX(0px);
  }
}

/* Header - FIXED: Removed -webkit-backdrop-filter warning */
.tgme_head_wrap {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 54px;
  padding: 10px 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: var(--box-bg-blured);
  backdrop-filter: blur(25px);
  z-index: 1;
}

/* Safari/WebKit support for backdrop-filter */
@supports (-webkit-backdrop-filter: blur(25px)) {
  .tgme_head_wrap {
    -webkit-backdrop-filter: blur(25px);
  }
}

.tgme_head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%; /* Added to ensure full height alignment */
}

a.tgme_head_brand {
  display: flex;
  align-items: center; /* Vertically center the logo */
  height: 100%;
}

a.tgme_head_right_btn {
  display: inline-flex;
  align-items: center; /* Vertically center the button text */
  font-size: 14px;
  line-height: 17px;
  font-weight: bold;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-btn-color);
  padding: 9px 16px;
  border-radius: 17px;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease;
  height: fit-content; /* Adjust button height to content */
}

a.tgme_head_right_btn:hover {
  background: var(--accent-color-hover);
  text-decoration: none;
}

/* Body */
.tgme_body_wrap {
  padding: 70px 16px 40px;
}

.tgme_page {
  position: relative;
  margin: 16px auto;
  padding: 32px 0;
  max-width: 400px;
  background: var(--box-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  text-align: center;
}

.tgme_page_photo {
  text-align: center;
  padding-bottom: 16px;
}

.tgme_page_photo_image {
  width: 122px;
  height: 122px;
  border-radius: 61px;
  object-fit: cover;
}

.tgme_page_title {
  font-size: 26px;
  line-height: 32px;
  font-weight: bold;
  color: var(--text-color);
  padding: 0 20px;
  margin: 0 auto;
}

.tgme_page_description {
  font-size: 16px;
  line-height: 25px;
  color: var(--text-color);
  padding: 10px 20px 0;
  margin: 0 auto;
  max-width: 340px;
}

/* Action Button */
.tgme_page_action {
  text-align: center;
  margin-top: 24px;
}

a.tgme_action_button_new {
  font-size: 14px;
  line-height: 17px;
  font-weight: bold;
  color: #fff;
  background: var(--accent-btn-color);
  border-radius: 22px;
  display: inline-block;
  padding: 13px 24px;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

a.tgme_action_button_new.shine {
  background-image: linear-gradient(
    270deg,
    rgba(100, 181, 239, 0) 48.44%,
    #64b5ef 75.52%,
    rgba(100, 181, 239, 0) 100%
  );
  background-repeat: no-repeat;
  animation: bg-move linear 5s infinite;
}

a.tgme_action_button_new:hover {
  background-color: var(--accent-color-hover);
  text-decoration: none;
}

@keyframes bg-move {
  0% {
    background-position: -500px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Additional Info */
.tgme_page_additional {
  font-size: 14px;
  line-height: 23px;
  color: #808080;
  padding: 0 20px;
  margin-top: 32px;
}

/* Responsive */
@media (max-width: 480px) {
  .tgme_page_photo_image {
    width: 110px;
    height: 110px;
  }

  .tgme_page_title {
    font-size: 22px;
  }

  .tgme_page_description {
    font-size: 15px;
  }

  .tgme_page_additional {
    display: block;
  }
}
