/* Import Roboto Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --bg-color: #eef2f3;
  --card-bg: #ffffff;
  --text-primary: #000000;
  --text-secondary: #707579;
  --accent-color: #2481cc;
  --accent-hover: #1a71b7;
  --btn-text: #ffffff;
  --border-color: #e0e0e0;
  --tme-logo-color: #2481cc;
  --accent-btn-color: #2481cc;
  --header-bg: #ffffff;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --font-family: 'Roboto', -apple-system, blinkmacsystemfont, "Segoe UI", sans-serif;
}

/* Dark Theme Variables */
.theme_dark {
  --bg-color: #181818;
  --card-bg: #212121;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --accent-color: #3390ec;
  --accent-hover: #2b7ec9;
  --btn-text: #ffffff;
  --border-color: #2f2f2f;
  --tme-logo-color: #ffffff;
  --accent-btn-color: #3390ec;
  --header-bg: #212121;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Canvas Background Wrapper */
.tgme_background_wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.tgme_background {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG Repeating Chat Pattern Overlay */
.tgme_background_pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160' fill='none' stroke='%23ffffff' stroke-width='0.8' stroke-linecap='round' stroke-linejoin='round' opacity='0.08'%3E%3Cpath d='M25 25l10 3-4 4zM31 32l1 5 3-4M60 20a4 4 0 014 4v4a4 4 0 01-4 4 4 4 0 01-4-4v-4a4 4 0 014-4zM100 35l12-3-3 8zM140 25c2 0 4 2 4 4s-2 4-4 4-4-2-4-4 2-4 4-4zM20 70c0-4 3-7 7-7h10c4 0 7 3 7 7v5l-4-4H27c-4 0-7-3-7-7zM70 70l6-6 6 6-6 6zM110 70h12v12h-12zM145 75a5 5 0 100-10 5 5 0 000 10zM35 125l5-12 7 7zM75 120c3 0 5 2 5 5s-2 5-5 5-5-2-5-5 2-5 5-5zM120 125c0-5 4-9 9-9h6a9 9 0 019 9v3l-3-3h-12c-5 0-9-4-9-9z'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

.theme_dark .tgme_background_pattern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160' fill='none' stroke='%23000000' stroke-width='0.8' stroke-linecap='round' stroke-linejoin='round' opacity='0.15'%3E%3Cpath d='M25 25l10 3-4 4zM31 32l1 5 3-4M60 20a4 4 0 014 4v4a4 4 0 01-4 4 4 4 0 01-4-4v-4a4 4 0 014-4zM100 35l12-3-3 8zM140 25c2 0 4 2 4 4s-2 4-4 4-4-2-4-4 2-4 4-4zM20 70c0-4 3-7 7-7h10c4 0 7 3 7 7v5l-4-4H27c-4 0-7-3-7-7zM70 70l6-6 6 6-6 6zM110 70h12v12h-12zM145 75a5 5 0 100-10 5 5 0 000 10zM35 125l5-12 7 7zM75 120c3 0 5 2 5 5s-2 5-5 5-5-2-5-5 2-5 5-5zM120 125c0-5 4-9 9-9h6a9 9 0 019 9v3l-3-3h-12c-5 0-9-4-9-9z'/%3E%3C/svg%3E");
}

/* Page Layout */
.tgme_page_wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}

/* Header */
.tgme_head_wrap {
  width: 100%;
  max-width: 1000px;
  padding: 0 16px;
  margin-top: 10px;
}

.tgme_head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  background-color: var(--header-bg);
  border-radius: 26px;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
}

.tgme_head_brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.tgme_logo {
  display: block;
}

.tgme_head_right_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  border: 1.5px solid var(--accent-color);
  border-radius: 16px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tgme_head_right_btn:hover {
  background-color: var(--accent-color);
  color: var(--btn-text);
}

/* Body and Card */
.tgme_body_wrap {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px 60px 16px;
  width: 100%;
}

.tgme_page {
  background-color: var(--card-bg);
  border-radius: 20px;
  padding: 36px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--card-shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Photo */
.tgme_page_photo {
  margin-bottom: 18px;
}

.tgme_page_photo_image {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Title */
.tgme_page_title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--text-primary);
  word-break: break-word;
}

/* Extra Info / Subscribers */
.tgme_page_extra {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Description */
.tgme_page_description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
  word-break: break-word;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

/* Action Button */
.tgme_page_action {
  width: 100%;
  margin-bottom: 20px;
}

.tgme_action_button_new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 46px;
  background-color: var(--accent-color);
  color: var(--btn-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 23px;
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.tgme_action_button_new:hover {
  background-color: var(--accent-hover);
}

.tgme_action_button_new:active {
  transform: scale(0.98);
}

/* Button Shine Animation */
.tgme_action_button_new.shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 30%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    left: -50%;
  }
  30% {
    left: 125%;
  }
  100% {
    left: 125%;
  }
}

/* Additional text */
.tgme_page_additional {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  word-break: break-word;
}

.tgme_page_additional strong {
  font-weight: 500;
  color: var(--text-primary);
}

/* Frame container placeholder */
#tgme_frame_cont {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .tgme_head_wrap {
    margin-top: 0;
    padding: 0;
  }
  
  .tgme_head {
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }
  
  .tgme_body_wrap {
    padding: 0;
    align-items: flex-start;
  }
  
  .tgme_page {
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    min-height: calc(100vh - 52px);
    background-color: transparent;
    padding: 30px 20px;
  }
  
  body {
    background-color: var(--card-bg);
  }
  
  .tgme_background_wrap {
    display: none;
  }
}
