:root {
  color-scheme: dark;

  /* Telegram / MAX dark theme tokens */
  --background-primary: #17181c;
  --background-secondary: #212328;
  --background-card: #25262d;
  --background-elevated: #2d2e36;
  --surface-overlay: #ffffff17;
  --surface-hover: #ffffff1f;
  --border-subtle: #ffffff1a;
  --border-medium: #ffffff24;

  --text-primary: #ffffff;
  --text-secondary: #ffffffa3;
  --text-tertiary: #ffffff6b;
  --text-link: #007aff;
  --text-negative: #ce4257;
  --text-success: #22c26b;

  --themed: #007aff;
  --themed-hover: #479fff;
  --themed-muted: #007aff29;
  --themed-soft: #007aff1a;

  --gr-spin-duration: 8500ms;
  --font-roboto: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;

  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-soft: 0 4px 24px #00000029;
  --shadow-modal: 0 16px 48px #00000052;
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--background-primary);
  width: 100%;
  min-height: 100%;
  margin: 0;
  font-family: var(--font-roboto);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* ── Background pattern (TG-style) ── */
.background-art,
.background-glow,
.pattern {
  pointer-events: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.background-art {
  background: #505bc74d;
  overflow: hidden;
  -webkit-mask-image: url('../images/pattern.svg');
  mask-image: url('../images/pattern.svg');
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: auto;
  mask-size: auto;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
}

.background-glow {
  display: none;
}

.pattern {
  color: #2d53cb6b;
  pointer-events: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pattern-top {
  opacity: 0.74;
  height: 54%;
}

.pattern-bottom {
  opacity: 0.84;
  height: 45%;
  top: auto;
  bottom: -1%;
}

/* ── Shell ── */
.gr-shell {
  position: relative;
  min-height: 100dvh;
  color: var(--text-primary);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #007aff73 #ffffff0a;
}

.gr-shell::before {
  content: '';
  pointer-events: none;
  z-index: 0;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 12%, #007aff29, transparent 34%),
    radial-gradient(circle at 85% 78%, #bf5af21a, transparent 30%);
}

.gr-shell::-webkit-scrollbar {
  width: 6px;
}

.gr-shell::-webkit-scrollbar-thumb {
  background: #7a7c8280;
  border-radius: 4px;
}

.gr-page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 100dvh;
  padding: 24px 16px 32px;
  animation: gr-page-in 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gr-page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Header ── */
.gr-header {
  width: min(100%, 360px);
  text-align: center;
}

.gr-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--themed-soft);
  color: var(--themed-hover);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.gr-kicker::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--themed);
}

.gr-header h1 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0;
}

.gr-header p {
  max-width: 34ch;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.15px;
}

/* ── Reel ── */
.gr-reel-wrap {
  width: min(100%, 360px);
}

.gr-reel {
  --gr-card-size: 112px;
  --gr-gap: 12px;
  position: relative;
}

.gr-reel__frame {
  position: relative;
  overflow: hidden;
  padding: 14px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--background-card);
  box-shadow: var(--shadow-soft);
}

.gr-reel__ambient span {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.55;
  animation: gr-float 6s ease-in-out infinite;
}

.gr-reel__ambient span:first-child {
  top: -8px;
  left: 8%;
  width: 72px;
  height: 72px;
  background: #007aff59;
}

.gr-reel__ambient span:nth-child(2) {
  right: 6%;
  bottom: 4px;
  width: 56px;
  height: 56px;
  background: #bf5af247;
  animation-delay: 1.2s;
}

.gr-reel__ambient span:nth-child(3) {
  top: -18px;
  left: 42%;
  width: 40px;
  height: 40px;
  background: #64d2ff40;
  animation-delay: 2.1s;
}

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

.gr-reel__glow {
  position: absolute;
  inset: 10% 8%;
  border-radius: var(--radius-lg);
  pointer-events: none;
  background: radial-gradient(circle, var(--themed-muted), transparent 72%);
  opacity: 0;
  transition: opacity 0.35s;
}

.gr-reel--spinning .gr-reel__glow {
  opacity: 1;
}

.gr-reel--landed .gr-reel__glow {
  opacity: 1;
  background: radial-gradient(circle, #007aff47, transparent 70%);
}

.gr-reel__frame-shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, #ffffff0f 50%, transparent 60%);
  transform: translateX(-120%);
  animation: gr-frame-shine 5s ease-in-out infinite;
}

@keyframes gr-frame-shine {
  0%, 70% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

.gr-reel__viewport {
  position: relative;
  height: var(--gr-card-size);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12% 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12% 88%, transparent);
}

.gr-reel__marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: var(--gr-card-size);
  height: var(--gr-card-size);
  margin: auto 0;
  transform: translateX(-50%);
  border: 2px solid var(--themed);
  border-radius: var(--radius-md);
  pointer-events: none;
  transition: border-color 0.25s, transform 0.25s;
}

.gr-reel--spinning .gr-reel__marker {
  animation: gr-marker-pulse 0.9s ease-in-out infinite;
}

.gr-reel--landed .gr-reel__marker {
  border-color: var(--themed-hover);
  animation: gr-marker-land 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes gr-marker-land {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.04); }
  100% { transform: translateX(-50%) scale(1); }
}

@keyframes gr-marker-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.gr-reel__marker::before,
.gr-reel__marker::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
}

.gr-reel__marker::before {
  top: -9px;
  border-bottom: 9px solid var(--themed);
}

.gr-reel__marker::after {
  bottom: -9px;
  border-top: 9px solid var(--themed);
}

.gr-reel__track {
  display: flex;
  align-items: center;
  gap: var(--gr-gap);
  height: 100%;
  will-change: transform;
}

.gr-reel__track--spinning {
  transition: transform var(--gr-spin-duration) cubic-bezier(0.12, 0.82, 0.18, 1);
}

.gr-reel__item {
  flex: 0 0 var(--gr-card-size);
  height: var(--gr-card-size);
}

.gr-reel__card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--gr-card-size);
  height: var(--gr-card-size);
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--background-secondary);
}

.gr-reel__card-shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, #ffffff1f 50%, transparent 65%);
  transform: translateX(-130%);
  animation: gr-card-shine 4.5s ease-in-out infinite;
}

@keyframes gr-card-shine {
  0%, 65% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

.gr-gift-lottie {
  position: relative;
  z-index: 1;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.gr-gift-lottie__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: opacity 0.25s ease;
}

.gr-gift-lottie__fallback--hidden {
  opacity: 0;
  pointer-events: none;
}

.gr-gift-lottie__canvas {
  position: absolute;
  inset: 0;
}

.gr-gift-lottie__canvas svg,
.gr-gift-lottie__canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.gr-spin,
.gr-auth__submit,
.gr-win__claim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border-radius: var(--radius-xl);
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 20px;
  background: linear-gradient(135deg, #0a84ff 0%, #0056d6 100%);
  box-shadow: 0 10px 28px #007aff61, inset 0 1px #ffffff2e;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  position: relative;
  overflow: hidden;
}

.gr-spin:hover:not(:disabled),
.gr-auth__submit:hover:not(:disabled),
.gr-win__claim:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px #007aff6b, inset 0 1px #fff3;
}

.gr-spin:active:not(:disabled),
.gr-auth__submit:active:not(:disabled),
.gr-win__claim:active:not(:disabled) {
  opacity: 0.92;
}

.gr-spin:disabled:not(.gr-spin--loading) {
  color: #ffffff47;
  background: #ffffff1f;
}

.gr-spin--loading {
  color: transparent;
}

.gr-spin {
  position: relative;
  width: min(100%, 336px);
}

.gr-spin__label {
  position: relative;
  z-index: 1;
}

.gr-spin__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #ffffff47;
  border-top-color: #fff;
  border-radius: 50%;
  animation: gr-spin-rotate 0.75s linear infinite;
}

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

.gr-hint {
  margin: 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.2px;
}

/* ── Win modal ── */
.gr-confetti {
  position: fixed;
  inset: 0;
  z-index: 31;
  pointer-events: none;
  overflow: hidden;
}

.gr-confetti__piece {
  position: absolute;
  top: -12px;
  opacity: 0;
  border-radius: 2px;
  animation-name: gr-confetti-fall;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
  animation-fill-mode: forwards;
}

@keyframes gr-confetti-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--gr-drift), 105vh, 0) rotate(720deg); }
}

.gr-win {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 0;
}

.gr-win__backdrop {
  position: absolute;
  inset: 0;
  background: #0d0d0da3;
  animation: gr-backdrop-in 0.25s ease-out;
}

@keyframes gr-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gr-win__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  text-align: center;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  background: var(--background-card);
  animation: gr-sheet-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gr-sheet-in {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.gr-win__shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 38%, #ffffff12 50%, transparent 62%);
  transform: translateX(-130%);
  animation: gr-win-shine 1.8s 0.2s forwards;
}

@keyframes gr-win-shine {
  to { transform: translateX(130%); }
}

.gr-win__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--themed-soft);
  color: var(--themed-hover);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.gr-win__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--themed);
}

.gr-win__title {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0;
}

.gr-win__subtitle {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.15px;
}

.gr-win__gift {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 12px;
  animation: gr-gift-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

@keyframes gr-gift-pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.gr-win__gift-ring {
  position: absolute;
  inset: -16px;
  border: 1px solid #007aff59;
  border-radius: 50%;
  animation: gr-ring-spin 8s linear infinite;
}

.gr-win__gift-ring::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed #64d2ff40;
  border-radius: 50%;
}

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

.gr-win__gift-glow {
  position: absolute;
  inset: -14px;
  border-radius: 30px;
  background: radial-gradient(circle, #007aff57, transparent 68%);
  animation: gr-glow-pulse 2.4s ease-in-out infinite;
}

@keyframes gr-glow-pulse {
  0%, 100% { opacity: 0.62; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.05); }
}

.gr-gift-lottie--win {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background: var(--background-secondary);
}

.gr-gift-lottie--win .gr-gift-lottie__fallback {
  object-fit: cover;
}

.gr-win__name {
  margin: 0 0 20px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.15px;
  animation: gr-fade-up 0.4s 0.15s both;
}

@keyframes gr-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.gr-win__claim {
  animation: gr-fade-up 0.4s 0.22s both;
}

/* ── Actions ── */
.gr-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 336px);
}

/* ── Auth shell ── */
.gr-auth {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 16px;
}

.gr-auth--country-open {
  overflow: hidden;
}

.gr-auth__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 420px);
  min-height: auto;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--background-card);
  box-shadow: var(--shadow-modal);
  animation: gr-page-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gr-auth__shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 38%, #ffffff0f 50%, transparent 62%);
  transform: translateX(-130%);
  animation: gr-win-shine 1.6s 0.15s forwards;
}

.gr-auth__widget-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
}

.gr-auth__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.gr-auth__user-line {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.gr-auth__user-line strong {
  color: var(--text-primary);
}

.gr-auth__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 8px;
}

.gr-auth__back {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 0 0 -12px;
  border-radius: 18px;
  color: #ffffffe0;
  transition: background 0.12s;
}

.gr-auth__back span {
  display: none;
}

.gr-auth__back:hover {
  background: #ffffff14;
}

.gr-auth__back svg {
  width: 24px;
  height: 24px;
}

.gr-auth__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--themed-soft);
  color: var(--themed-hover);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.gr-auth__badge-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--themed);
  box-shadow: 0 0 8px var(--themed);
}

.gr-auth__gift {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #007aff14 0%, #ffffff08 100%);
}

.gr-auth__gift-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--background-card);
  box-shadow: 0 2px 8px #00000033;
}

.gr-auth__gift-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gr-auth__gift-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gr-auth__gift-label {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.gr-auth__gift-text strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gr-auth__gift img {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

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

.gr-auth__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding-top: 32px;
}

.gr-auth__stage--code {
  padding-top: 24px;
}

.gr-auth__heading {
  width: 100%;
  margin-bottom: 28px;
  text-align: center;
}

.gr-auth__heading h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -0.2px;
}

.gr-auth__heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: 0;
}

.gr-auth__phone-display {
  margin: 12px 0 0;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* Phone control — unified TG bar */
.gr-auth__phone-wrap {
  width: 100%;
}

.gr-auth__phone-control {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  height: 54px;
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--background-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gr-auth__phone-control:focus-within {
  border-color: #007aff66;
  box-shadow: 0 0 0 3px var(--themed-soft);
}

.gr-auth__phone-control--error {
  border-color: #ce425773;
  box-shadow: none;
}

.gr-auth__phone-divider {
  flex-shrink: 0;
  width: 1px;
  height: 22px;
  margin: 0 6px;
  background: var(--border-medium);
}

.gr-auth__country-wrap {
  position: relative;
  flex-shrink: 0;
}

.gr-auth__country-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 8px 0 0;
  color: var(--text-primary);
  white-space: nowrap;
}

.gr-auth__country-trigger strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.gr-auth__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 18px;
  line-height: 1;
}

.gr-auth__dial-input {
  flex: none;
  width: 48px;
  min-width: 38px;
  max-width: 56px;
  height: 40px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  caret-color: var(--themed);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.gr-auth__dial-input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.gr-auth__dial {
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
}

.gr-auth__chevron {
  display: flex;
  align-items: center;
  padding: 0 2px;
  color: var(--text-primary);
  transition: transform 0.2s;
}

.gr-auth__chevron svg {
  width: 12px;
  height: 12px;
}

.gr-auth__chevron--up {
  transform: rotate(180deg);
}

.gr-auth__phone-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  caret-color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
}

.gr-auth__phone-input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.gr-auth__phone-hint {
  min-height: 0;
  margin: 0;
  padding: 4px 12px 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.2px;
}

/* Country picker */
.gr-auth__country-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: #0d0d0da3;
  animation: gr-backdrop-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gr-auth__country-list {
  position: fixed;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background-primary);
  box-shadow: 0 16px 16px #00000029, 0 0 8px #0000001f;
  animation: gr-country-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gr-country-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.gr-auth__country-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  margin: 0;
  padding: 6px;
}

.gr-auth__country-search::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-overlay);
}

.gr-auth__country-search svg {
  z-index: 1;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0 8px 0 10px;
  color: #ffffff85;
}

.gr-auth__country-search input {
  z-index: 1;
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
}

.gr-auth__country-search input::placeholder {
  color: var(--text-secondary);
}

.gr-auth__country-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.gr-auth__country-items::-webkit-scrollbar {
  display: none;
}

.gr-auth__country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.15px;
  text-align: left;
  transition: background 0.12s;
}

.gr-auth__country-item:hover {
  background: var(--surface-overlay);
}

.gr-auth__country-item--current {
  background: var(--themed-soft);
}

.gr-auth__country-item--custom {
  border-bottom: 1px solid #ffffff12;
}

.gr-auth__country-item strong {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.gr-auth__country-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gr-auth__country-item i {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
  color: #ffffff66;
  font-size: 15px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.gr-auth__country-empty {
  margin: 0;
  padding: 20px 12px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}

/* Password control */
.gr-auth__password-control {
  display: flex;
  align-items: center;
  width: 100%;
  height: 52px;
  margin-bottom: 4px;
  padding: 6px 6px 6px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface-overlay);
  transition: outline 0.12s;
}

.gr-auth__password-control--error {
  animation: gr-code-jump 0.4s ease-out;
}

.gr-auth__password-control--error .gr-auth__password-input {
  color: var(--text-negative);
}

.gr-auth__password-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  caret-color: var(--text-primary);
  font-size: 15px;
  line-height: 24px;
}

.gr-auth__password-input::placeholder {
  color: var(--text-secondary);
}

.gr-auth__toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: #ffffffa3;
  font-size: 0;
  transition: color 0.12s, background 0.12s;
}

.gr-auth__toggle:hover {
  color: #ffffffe0;
  background: #ffffff0f;
}

.gr-auth__password-hint {
  width: 100%;
  margin: 0 0 8px;
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

/* Shared form elements */
.gr-auth__error {
  width: 100%;
  margin: 6px 0 0;
  padding: 0 12px;
  color: var(--text-negative);
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.2px;
}

.gr-auth__submit {
  width: 100%;
  margin-top: 24px;
  min-height: 50px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  background: var(--themed);
  box-shadow: none;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

.gr-auth__submit:hover:not(:disabled) {
  background: var(--themed-hover);
  transform: none;
  box-shadow: none;
}

.gr-auth__submit:active:not(:disabled) {
  opacity: 0.88;
}

.gr-auth__submit:disabled {
  color: #ffffff59;
  background: #ffffff14;
}

.gr-auth__spinner {
  width: 20px;
  height: 20px;
  animation: gr-spin-rotate 0.75s linear infinite;
}

.gr-auth__spinner circle {
  fill: none;
  stroke: #fff;
  stroke-width: 4px;
  stroke-dasharray: 90;
  stroke-dashoffset: 60px;
  stroke-linecap: round;
}

/* Code cells — 5 digits */
.gr-auth__code-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.gr-auth__code-wrap--loading .gr-auth__code {
  opacity: 0.45;
  pointer-events: none;
}

.gr-auth__code-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.gr-auth__code {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.gr-auth__cell {
  flex: 1;
  width: 52px;
  max-width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--background-card);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  caret-color: var(--themed);
  appearance: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.gr-auth__cell--filled {
  border-color: #007aff44;
  background: #007aff0d;
}

.gr-auth__cell:focus {
  border-color: var(--themed);
  outline: none;
  box-shadow: 0 0 0 3px var(--themed-soft);
}

.gr-auth__cell--error {
  color: var(--text-negative);
  animation: gr-code-jump 0.4s ease-out;
  animation-delay: calc(var(--i, 0) * 80ms);
}

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

.gr-auth__code-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 18px;
}

.gr-auth__timer {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.2px;
  text-align: center;
}

.gr-auth__link {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--themed);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.15px;
  transition: background 0.12s;
}

.gr-auth__link:hover:not(:disabled) {
  background: #e7e7e70a;
}

.gr-auth__link:active:not(:disabled) {
  background: #e7e7e714;
}

.gr-auth__link--muted {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
}

/* Success */
.gr-auth__success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 336px;
  margin: 0 auto;
  padding: 48px 0 24px;
  text-align: center;
}

.gr-auth__success h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
}

.gr-auth__success p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.15px;
}

.success-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.success-progress__visual {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.success-progress__label {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.15px;
  transition: color 0.2s;
}

.success-progress--done .success-progress__label {
  color: var(--text-success);
}

.success-progress__spinner {
  width: 56px;
  height: 56px;
  animation: success-progress-rotate 1.4s linear infinite;
}

.success-progress__spinner-track {
  fill: none;
  stroke: var(--themed-muted);
  stroke-width: 4px;
}

.success-progress__spinner-arc {
  fill: none;
  stroke: var(--themed);
  stroke-width: 4px;
  stroke-linecap: round;
  stroke-dasharray: 90 200;
  transform-origin: 50%;
  animation: success-progress-arc 1.4s ease-in-out infinite;
}

.success-progress__check {
  width: 60px;
  height: 60px;
  animation: success-progress-pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.success-progress__check-circle {
  fill: #22c26b24;
  stroke: var(--text-success);
  stroke-width: 2.5px;
}

.success-progress__check-mark {
  fill: none;
  stroke: var(--text-success);
  stroke-width: 4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60px;
  animation: success-progress-draw 0.38s ease-out 0.12s forwards;
}

@keyframes success-progress-rotate {
  to { transform: rotate(360deg); }
}

@keyframes success-progress-arc {
  0% { stroke-dasharray: 10 200; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90 200; stroke-dashoffset: -35px; }
  100% { stroke-dasharray: 10 200; stroke-dashoffset: -125px; }
}

@keyframes success-progress-pop {
  0% { opacity: 0; transform: scale(0.4); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes success-progress-draw {
  to { stroke-dashoffset: 0; }
}

/* ── Desktop overrides ── */
@media (min-width: 601px) {
  .gr-win {
    place-items: center;
    padding: 20px 16px;
  }

  .gr-win__panel {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--border-subtle);
    padding: 26px 22px 22px;
    animation: gr-win-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes gr-win-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .gr-auth__panel {
    width: min(420px, calc(100vw - 32px));
    min-height: auto;
    max-height: min(720px, calc(100dvh - 32px));
    margin: auto;
    padding: 16px 24px 24px;
    overflow: auto;
  }

  .gr-auth__stage {
    padding-top: 20px;
  }

  .gr-auth__country-list {
    top: 50%;
    left: 50%;
    width: 312px;
    height: 404px;
    padding: 6px;
    border-radius: var(--radius-lg);
    transform: translate(-50%, -50%);
  }

  .gr-auth__country-items {
    max-height: 350px;
    padding: 0 6px 6px;
  }
}

@media (max-width: 600px) {
  .gr-auth__phone-input,
  .gr-auth__password-input,
  .gr-auth__country-search input {
    font-size: 16px;
  }

  .gr-auth {
    padding: 12px;
  }

  .gr-auth__panel {
    width: 100%;
    min-height: auto;
    max-height: calc(100dvh - 24px);
    margin: 0;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
  }

  .gr-auth__stage {
    padding-top: 16px;
  }

  .gr-auth__country-list {
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: none;
    height: calc(100dvh - 72px);
    padding-top: 12px;
    border-radius: 20px 20px 0 0;
    animation: gr-sheet-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .gr-auth__country-list::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: #ffffff52;
  }

  .gr-auth__country-search {
    padding: 6px 16px;
  }

  .gr-auth__country-search::before {
    left: 16px;
    right: 16px;
  }

  .gr-auth__country-items {
    padding: 0 16px 6px;
  }

  .gr-page {
    padding-top: 16px;
  }

  .gr-reel {
    --gr-card-size: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gr-page,
  .gr-reel__frame-shine,
  .gr-reel__card-shine,
  .gr-reel__ambient span,
  .gr-reel--spinning .gr-reel__marker,
  .gr-reel--spinning .gr-reel__glow,
  .gr-reel--landed .gr-reel__marker,
  .gr-win__panel,
  .gr-win__gift,
  .gr-win__name,
  .gr-win__claim,
  .gr-win__shine,
  .gr-win__gift-ring,
  .gr-confetti__piece,
  .gr-auth__panel,
  .gr-auth__shine {
    animation: none !important;
  }

  .gr-reel__track--spinning {
    transition-duration: 0.01ms;
  }
}
