/* Telegram CSS Variables - Фиолетовая тема */
:root {
  --tg-theme-accent-text-color: #b87cff;
  --tg-color-scheme: dark;
  --tg-theme-bg-color: #12121c;
  --tg-theme-bottom-bar-bg-color: #12121c;
  --tg-theme-button-color: #7c3aed;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-destructive-text-color: #ff4949;
  --tg-theme-header-bg-color: #12121c;
  --tg-theme-hint-color: #8b8ca8;
  --tg-theme-link-color: #b87cff;
  --tg-theme-secondary-bg-color: #1e1e2e;
  --tg-theme-section-bg-color: #12121c;
  --tg-theme-section-header-text-color: #b87cff;
  --tg-theme-section-separator-color: #2a2a3a;
  --tg-theme-subtitle-text-color: #8b8ca8;
  --tg-theme-text-color: #f5f3ff;
  --tg-viewport-height: 648px;
  --tg-viewport-stable-height: 648px;
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-safe-area-inset-left: 0px;
  --tg-safe-area-inset-right: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --tg-content-safe-area-inset-left: 0px;
  --tg-content-safe-area-inset-right: 0px;
}

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

html, body, #app {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  background-color: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  overflow: hidden;
}

.screen {
  position: relative;
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  touch-action: manipulation;
}

.content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.content > * {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes shake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-5px); }
  40% { transform: translate(5px); }
  60% { transform: translate(-3px); }
  80% { transform: translate(3px); }
}

.emoji-wrapper {
  width: 150px;
  height: 150px;
  margin: 0 auto;
}

.emoji {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  animation: float 3s ease-in-out infinite;
}

.text-container {
  width: 100%;
  max-width: 300px;
  text-align: center;
  color: var(--tg-theme-text-color);
  background-color: rgba(30, 30, 46, 0.95);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.4;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  opacity: 0.95;
}

.phone-button, .camera-button, .confirm-button, .done-button {
  height: 60px;
  width: 100%;
  max-width: 340px;
  border: none;
  border-radius: 10px;
  background: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.phone-button:hover, .camera-button:hover, .confirm-button:hover, .done-button:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
  opacity: 1;
}

.phone-button:active, .camera-button:active, .confirm-button:active, .done-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.1s ease;
}

.code-page {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.code-input {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.cell {
  width: 48px;
  min-width: 44px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--tg-theme-button-text-color);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.3), 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.cell.filled {
  background: rgba(124, 58, 237, 0.45);
  color: var(--tg-theme-button-text-color);
  font-weight: 700;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.6), 0 4px 14px rgba(124, 58, 237, 0.35);
  z-index: 2;
}

.cell.error {
  background: rgba(229, 57, 53, 0.15);
  color: #ff6b6b;
  animation: shake 0.4s ease;
  box-shadow: inset 0 0 0 3px #ff6b6b, 0 0 0 2px rgba(255, 107, 107, 0.3), 0 0 14px rgba(255, 107, 107, 0.4);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 280px;
  justify-content: center;
}

.key {
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
  font-size: 22px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.key:active {
  transform: translateY(2px) scale(0.95);
  opacity: 0.9;
}

.spacer {
  width: 70px;
}

.button-code {
  height: 40px;
  width: 100%;
  max-width: 280px;
  border: none;
  border-radius: 12px;
  background: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease, opacity 0.2s ease;
}

.button-code:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.password-input {
  width: 100%;
  max-width: 320px;
  height: 50px;
  border: 2px solid var(--tg-theme-section-separator-color);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 18px;
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.password-input:focus {
  border-color: var(--tg-theme-button-color);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

.password-input::placeholder {
  color: var(--tg-theme-hint-color);
  text-align: center;
}

.password-input.error {
  border-color: #ff6b6b;
  color: #ff6b6b;
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

@media (max-width: 480px) {
  .cell {
    width: 45px;
    min-width: 40px;
    height: 55px;
    font-size: 24px;
  }
  
  .text-container {
    font-size: 14px;
  }
  
  .phone-button, .camera-button, .confirm-button, .done-button {
    height: 50px;
    font-size: 18px;
  }
}