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

:root {
  --bg: #080c14;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-strong: rgba(255, 255, 255, 0.16);
  --text: #f0f0f0;
  --text-muted: #7a8aa0;
  --error: #e84040;
  --accent: #3d8ef0;
  --accent-2: #7c5cfc;
  --orb1: #2a5fc7;
  --orb2: #5c2fc7;
  --accent-tint: rgba(61, 142, 240, 0.06);
  --accent-glow: rgba(61, 142, 240, 0.30);
  --accent-glow-hover: rgba(61, 142, 240, 0.45);
  --header-h: 80px;
}

/* ── Sonic theme — gold / amber ── */
body[data-theme="sonic"] {
  --accent: #e8a82a;
  --accent-2: #d06200;
  --orb1: #c47a00;
  --orb2: #8b3000;
  --accent-tint: rgba(232, 168, 42, 0.06);
  --accent-glow: rgba(232, 168, 42, 0.30);
  --accent-glow-hover: rgba(232, 168, 42, 0.50);
}

/* ── Layout ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Colored ambient orbs so glass has something to blur against */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.22;
}
body::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--orb1) 0%, transparent 70%);
  top: -160px;
  left: -160px;
}
body::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--orb2) 0%, transparent 70%);
  bottom: -120px;
  right: -120px;
}

/* ── Floating background ── */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-icon {
  position: absolute;
  color: #fff;
  opacity: 0.05;
}

@keyframes floatA {
  0%   { transform: translateY(0px)   translateX(0px)   rotate(-6deg);  }
  25%  { transform: translateY(-32px) translateX(10px)  rotate(4deg);   }
  50%  { transform: translateY(-42px) translateX(4px)   rotate(-12deg); }
  75%  { transform: translateY(-20px) translateX(-8px)  rotate(2deg);   }
  100% { transform: translateY(0px)   translateX(0px)   rotate(-6deg);  }
}
@keyframes floatB {
  0%   { transform: translateY(0px)   translateX(0px)   rotate(8deg);  }
  30%  { transform: translateY(-28px) translateX(-12px) rotate(-6deg); }
  60%  { transform: translateY(-44px) translateX(-4px)  rotate(14deg); }
  80%  { transform: translateY(-18px) translateX(10px)  rotate(6deg);  }
  100% { transform: translateY(0px)   translateX(0px)   rotate(8deg);  }
}
@keyframes floatC {
  0%   { transform: translateY(0px)   translateX(0px)  rotate(0deg);   }
  40%  { transform: translateY(-38px) translateX(8px)  rotate(-10deg); }
  70%  { transform: translateY(-24px) translateX(-6px) rotate(6deg);   }
  100% { transform: translateY(0px)   translateX(0px)  rotate(0deg);   }
}

/* ── Top header ── */
.page-header {
  position: relative;
  z-index: 10;
  height: var(--header-h);
  border-bottom: 1px solid var(--glass-border-strong);
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.page-header-inner {
  margin: 0 auto;
  height: 100%;
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.shop-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.shop-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  white-space: nowrap;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.header-btn:active {
  transform: scale(0.97);
}

.header-btn.tg-btn {
  color: #72cff5;
}

.header-btn.max-btn {
  color: #8cb8ff;
}

/* ── Page center ── */
.page-center {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}

/* ── Card ── */
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border-strong);
  border-radius: 20px;
  padding: 48px 42px;
  width: 100%;
  max-width: 500px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 32px 64px rgba(0, 0, 0, 0.5);
}

.card-title {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 10px;
  text-align: center;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── Activate block ── */
#activate-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-wrap {
  position: relative;
}

.code-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border-strong);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 15px 18px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  letter-spacing: 0.03em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.code-input:focus {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.code-input::placeholder {
  color: rgba(255,255,255,0.2);
}

.code-input.error {
  border-color: var(--error);
}

.error-msg {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  min-height: 16px;
}

.btn-activate {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  padding: 15px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  letter-spacing: 0.03em;
  margin-top: 4px;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-activate:hover {
  opacity: 0.9;
  box-shadow: 0 6px 32px var(--accent-glow-hover);
}

.btn-activate:active {
  transform: scale(0.98);
}

.btn-activate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Success block ── */
#success-block {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  backdrop-filter: blur(8px);
}

.success-title {
  font-size: 20px;
  font-weight: 800;
  color: #4ade80;
}

.success-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 6px;
}

.social-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.social-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.social-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.social-btn:active {
  transform: scale(0.98);
}

.social-btn.telegram {
  color: #72cff5;
}

.social-btn.max {
  color: #8cb8ff;
}

.social-btn svg {
  flex-shrink: 0;
}

.social-btn-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: start;
}

.social-btn-title {
  font-size: 14px;
  font-weight: 700;
}

.social-btn-hint {
  font-size: 11px;
  opacity: 0.6;
  font-weight: 400;
}

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  padding: 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  text-align: center;
  flex-shrink: 0;
}

/* ── Spinner ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Tablet — card fills width ── */
@media (max-width: 600px) {
  .page-center {
    padding: 32px 16px;
  }
  .card {
    max-width: 100%;
    padding: 36px 24px;
    border-radius: 16px;
  }
}

/* ── Mobile — tighten header ── */
@media (max-width: 480px) {
  :root { --header-h: 66px; }

  .page-header-inner {
    padding: 0 14px;
    gap: 10px;
  }
  .shop-logo {
    height: 36px;
  }
  .shop-name {
    font-size: 16px;
    letter-spacing: 0.03em;
  }
  .header-actions {
    gap: 8px;
  }
  .header-btn {
    padding: 9px 12px;
    font-size: 13px;
    gap: 7px;
  }
  /* hide text labels — icons only */
  .header-btn .btn-label {
    display: none;
  }

  .page-center {
    padding: 28px 20px;
  }
  .card {
    padding: 28px 20px;
  }
  .card-title {
    font-size: 19px;
  }
  .card-subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }
}

/* ── Very small phones ── */
@media (max-width: 360px) {
  .shop-name {
    display: none;
  }
  .header-btn {
    padding: 9px 10px;
  }
}
