* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: #0d0d10;
  color: #ffffff;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 420px;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.25s ease-out forwards;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header & Robot */
.header-robot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 25px;
  margin-bottom: 20px;
}

.robot-icon {
  font-size: 76px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 8px 24px rgba(78, 150, 255, 0.25));
}

.main-title {
  font-size: 26px;
  font-weight: 700;
  color: #a782dc;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 15px;
  color: #7b7b8f;
  font-weight: 500;
}

.subtitle-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  color: #d1d1e0;
  margin-top: 4px;
}

.badge-check {
  font-size: 17px;
}

/* Step 1: Robot Screen */
.robot-instruction {
  margin-top: 36px;
  margin-bottom: 28px;
  font-size: 17px;
  font-weight: 600;
  color: #d6d6e6;
  text-align: center;
}

.action-section {
  width: 100%;
  margin-top: 10px;
}

.btn-primary {
  width: 100%;
  background: #6e4e9b;
  color: #ffffff;
  border: none;
  outline: none;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(110, 78, 155, 0.4);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:active {
  transform: scale(0.97);
  background: #5e4187;
  box-shadow: 0 4px 14px rgba(110, 78, 155, 0.5);
}

/* Fallback phone input */
.phone-fallback-box {
  margin-top: 24px;
  width: 100%;
  background: #15151c;
  border: 1px solid #282836;
  padding: 16px;
  border-radius: 14px;
  text-align: center;
}

.fallback-note {
  font-size: 14px;
  color: #aaaab8;
  margin-bottom: 12px;
}

.phone-input-row {
  display: flex;
  gap: 8px;
}

.phone-input-row input {
  flex: 1;
  background: #1d1d27;
  border: 1px solid #333346;
  border-radius: 10px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 16px;
  outline: none;
}

.phone-input-row input:focus {
  border-color: #8b62cb;
}

.btn-sm {
  background: #6e4e9b;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

/* Step 2: PIN Display */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 22px;
}

.pin-box {
  width: 54px;
  height: 60px;
  background: #171720;
  border: 1.5px solid #232332;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.pin-box.active {
  border-color: #8f65d6;
  box-shadow: 0 0 14px rgba(143, 101, 214, 0.35);
  background: #1c1c28;
}

.pin-box.filled {
  border-color: #564082;
  color: #ffffff;
}

.pin-box.error {
  border-color: #e74c3c !important;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* Gradient Show Code Button */
.btn-gradient {
  width: 100%;
  background: linear-gradient(90deg, #7c58b5 0%, #4686e0 100%);
  color: #ffffff;
  border: none;
  outline: none;
  padding: 15px 20px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(70, 134, 224, 0.35);
  margin-bottom: 22px;
  transition: transform 0.15s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-gradient:active {
  transform: scale(0.97);
  opacity: 0.92;
}

/* Keypad Grid */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.key-btn {
  background: #191922;
  border: none;
  outline: none;
  height: 60px;
  border-radius: 16px;
  color: #ffffff;
  font-size: 24px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.1s;
}

.key-btn:active {
  background: #2b2b3b;
  transform: scale(0.95);
}

.key-placeholder {
  visibility: hidden;
}

.key-backspace {
  display: flex;
  align-items: center;
  justify-content: center;
}

.backspace-icon {
  width: 28px;
  height: 28px;
  stroke: #ff4757;
}

/* Back Link */
.back-link-container {
  margin-top: 18px;
  text-align: center;
}

.btn-text-link {
  background: none;
  border: none;
  color: #9d80d6;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 16px;
  transition: opacity 0.15s;
}

.btn-text-link:active {
  opacity: 0.6;
}

/* Status Message */
.status-msg {
  margin-top: 14px;
  font-size: 14px;
  text-align: center;
  min-height: 22px;
  font-weight: 600;
}

.status-msg.error {
  color: #ff5252;
}

.status-msg.success {
  color: #2ed573;
}

.status-msg.loading {
  color: #70a1ff;
}
