@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700&display=swap');

:root {
  --bg: #050505;
  --card: rgba(255, 255, 255, 0.03);
  --text: #f2f4ff;
  --muted: #9aa2d3;
  --primary: #2b1c73;
  --primary-dark: #1b0e4f;
  --accent: #120a3a;
  --accent-bright: #4a3fb0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
.gate-open {
  overflow: hidden;
}
.gated {
  filter: blur(2px);
  pointer-events: none;
}

.background {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(53, 0, 211, 0.28), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(36, 0, 144, 0.12), transparent 35%),
    radial-gradient(circle at 60% 80%, rgba(25, 0, 97, 0.12), transparent 35%),
    linear-gradient(145deg, #050505, #0b0722 55%, #050505);
  filter: blur(0px);
  z-index: -1;
}

.container {
  padding: 20px 14px 60px;
  max-width: 480px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  position: relative;
  padding: 32px 0 18px;
}

.pulse {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.pulse-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(53, 0, 211, 0.25), rgba(36, 0, 144, 0.05));
  animation: pulse 3s infinite;
  filter: blur(6px);
}

.pulse-circle.delayed {
  position: absolute;
  animation-delay: 1.2s;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  50% { transform: scale(1.1); opacity: 0.5; }
  100% { transform: scale(0.85); opacity: 0.8; }
}

.logo {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  position: relative;
  z-index: 1;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  animation: vibrate 2.6s infinite ease-in-out;
}

.tagline {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 10px;
}

.label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}

.section-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.primary, .accent, .ghost {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  padding: 12px 14px;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 24px rgba(43, 28, 115, 0.3);
}

.accent {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-bright), var(--primary));
  color: #fff;
  box-shadow: 0 10px 24px rgba(74, 63, 176, 0.25);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#trial-btn {
  background: linear-gradient(135deg, #5a0f17, #2e070c);
  border: 1px solid rgba(255, 86, 98, 0.35);
  box-shadow: 0 10px 24px rgba(90, 15, 23, 0.35);
  justify-self: start;
  width: auto;
  padding: 10px 16px;
}

.primary:active, .accent:active, .ghost:active {
  transform: translateY(1px);
  opacity: 0.9;
}

.tariffs {
  display: grid;
  gap: 8px;
}

.tariff {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.tariff.active {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px rgba(255, 122, 24, 0.4);
}

.devices {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-picker button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.device-picker span {
  font-weight: 700;
}

.link-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.link {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}

.device-list {
  display: grid;
  gap: 10px;
}

.add-device-btn {
  width: 100%;
  margin-top: 8px;
}

.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.device-item.fade-new {
  opacity: 0;
  transform: translateY(6px);
}
.device-item.fade-new.show {
  opacity: 1;
  transform: translateY(0);
}

.fade-block {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.fade-block.show {
  opacity: 1;
  transform: translateY(0);
}

.alert {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.12);
  color: #ffd1cc;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

.fade-update {
  opacity: 0;
  transform: translateY(4px);
}
.fade-update.show {
  opacity: 1;
  transform: translateY(0);
}

.updating::after {
  content: "";
  position: static;
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--yellow);
  animation: spin 0.8s linear infinite;
}

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

@keyframes vibrate {
  0%, 100% { transform: translateX(0) scale(1); }
  12% { transform: translateX(-1px) rotate(-0.5deg); }
  24% { transform: translateX(1px) rotate(0.5deg); }
  36% { transform: translateX(-1px) rotate(-0.5deg); }
  48% { transform: translateX(1px) rotate(0.5deg); }
  60% { transform: translateX(0) scale(1.02); }
  72% { transform: translateX(-0.5px) rotate(-0.3deg); }
  84% { transform: translateX(0.5px) rotate(0.3deg); }
  96% { transform: translateX(0) scale(1); }
}

/* Gate overlay */
.gate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.gate.hidden {
  display: none;
}
.gate-card {
  width: 90%;
  max-width: 420px;
  background: #0d0d0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.gate-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}
.gate-body {
  font-size: 15px;
  color: #cfd2d8;
  margin-bottom: 16px;
}
.gate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gate-actions button {
  flex: 1 1 auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1600;
  padding: 20px 16px;
  min-height: 100vh;
}
.modal-card {
  width: 90%;
  max-width: 380px;
  background: #0d0d0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
}
.modal-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
.modal-card .range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
.modal-card input[type=range] {
  flex: 1;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.modal-actions button {
  flex: 1;
}

.user-info-card {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  line-height: 1.5;
}
.user-info-card .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.user-info-card .line:last-child {
  margin-bottom: 0;
}
.user-info-card .label {
  color: var(--muted);
}
.user-info-card .value {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

.helpers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

a.ghost {
  text-align: center;
  text-decoration: none;
  flex: 1 1 calc(33% - 8px);
}

.support-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.admin {
  border-color: rgba(241, 196, 15, 0.4);
  position: relative;
  overflow: hidden;
}

.admin-row, .admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pulse-card::before, .pulse-card::after {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.25), transparent 60%);
  filter: blur(14px);
  animation: pulse 4s infinite;
  top: -60px;
  right: -60px;
  z-index: 0;
}

.pulse-card::after {
  animation-delay: 1.2s;
  background: radial-gradient(circle, rgba(241, 196, 15, 0.25), transparent 60%);
  top: auto;
  bottom: -60px;
  left: -60px;
}

.pulse-card > * {
  position: relative;
  z-index: 1;
}

.admin input, .admin textarea {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.admin textarea {
  resize: vertical;
}

.admin-block {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.admin .ghost {
  width: auto;
}

.admin .danger {
  border-color: rgba(255, 59, 48, 0.5);
  color: #ffb3ad;
}

.maintenance-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(52, 73, 94, 0.2), rgba(52, 73, 94, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.maintenance-text .value {
  font-weight: 600;
  color: #fff;
}

.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 30px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: #fff;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent-bright), var(--primary));
  box-shadow: 0 6px 16px rgba(74, 63, 176, 0.4);
}

.switch input:checked + .slider:before {
  transform: translateX(26px);
}

@media (max-width: 420px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats button {
    grid-column: span 2;
  }

  a.ghost {
    flex: 1 1 100%;
  }
}
